mirror of
https://github.com/srid/nixos-config.git
synced 2026-01-17 21:07:54 +08:00
Parametrize userName
This commit is contained in:
parent
a25ea66b8c
commit
6e89eefc99
2 changed files with 8 additions and 7 deletions
|
|
@ -4,7 +4,7 @@ To build,
|
|||
|
||||
```sh
|
||||
# First, edit nixosConfigurations or darwinConfigurations in flake.nix to add
|
||||
# your system's hostname
|
||||
# your system's hostname. And then change `userName` to your username.
|
||||
make
|
||||
```
|
||||
|
||||
|
|
@ -16,14 +16,14 @@ make
|
|||
- Digital Ocean: https://github.com/elitak/nixos-infect
|
||||
- X1 Carbon: https://www.srid.ca/x1c7-install
|
||||
- Clone this repo at `/etc/nixos`
|
||||
- Edit `flake.nix` and add your Linux's hostname in the `nixosConfigurations` set.
|
||||
- Edit `flake.nix` and add your Linux's hostname in the `nixosConfigurations` set, as well as update `userName`.
|
||||
- Run `make`. That's it. Re-open your shell.
|
||||
- macOS:
|
||||
- Install Nix normally (multi-user)
|
||||
- Install [nix-darwin](https://github.com/LnL7/nix-darwin)
|
||||
- This will create a `~/.nixpkgs/darwin-configuration.nix`, but we do not need that.
|
||||
- Clone this repo anywhere
|
||||
- Edit `flake.nix` and add your Mac's [hostname](https://support.apple.com/en-ca/guide/mac-help/mchlp2322/mac) in the `darwinConfigurations` set.
|
||||
- Edit `flake.nix` and add your Mac's [hostname](https://support.apple.com/en-ca/guide/mac-help/mchlp2322/mac) in the `darwinConfigurations` set, as well update `userName`.
|
||||
- Run `make`.[^cleanup] That's it. Re-open your shell.
|
||||
|
||||
[^cleanup]: You might have to `rm -rf /etc/nix/nix.conf`, so our flake.nix can do its thing.
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
(inputs.neovim-nightly-overlay.overlay)
|
||||
];
|
||||
};
|
||||
userName = "srid";
|
||||
in
|
||||
{
|
||||
# Configurations for Linux (NixOS) systems
|
||||
|
|
@ -61,7 +62,7 @@
|
|||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = { inherit system inputs; };
|
||||
home-manager.users.srid = {
|
||||
home-manager.users.${userName} = {
|
||||
imports = [
|
||||
./home/tmux.nix
|
||||
./home/git.nix
|
||||
|
|
@ -115,7 +116,7 @@
|
|||
mountHome = false;
|
||||
mountNixProfile = false;
|
||||
extraMounts."/Downloads" = {
|
||||
target = "/home/srid/Downloads";
|
||||
target = "/home/${userName}/Downloads";
|
||||
cache = "none";
|
||||
};
|
||||
};
|
||||
|
|
@ -144,7 +145,7 @@
|
|||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = { inherit system inputs; };
|
||||
home-manager.users.srid = { pkgs, ... }: {
|
||||
home-manager.users.${userName} = { pkgs, ... }: {
|
||||
imports = [
|
||||
./home/git.nix
|
||||
./home/tmux.nix
|
||||
|
|
@ -157,7 +158,7 @@
|
|||
programs.zsh = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
export PATH=/etc/profiles/per-user/srid/bin:/run/current-system/sw/bin/:$PATH
|
||||
export PATH=/etc/profiles/per-user/${userName}/bin:/run/current-system/sw/bin/:$PATH
|
||||
'';
|
||||
} // (import ./home/shellcommon.nix { inherit pkgs; });
|
||||
home.stateVersion = "21.11";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue