diff --git a/flake.lock b/flake.lock index 32b9a29..1eb2875 100644 --- a/flake.lock +++ b/flake.lock @@ -20,9 +20,7 @@ }, "home-manager": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1731235328, @@ -57,7 +55,7 @@ "inputs": { "niri-stable": "niri-stable", "niri-unstable": "niri-unstable", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-stable": "nixpkgs-stable", "xwayland-satellite-stable": "xwayland-satellite-stable", "xwayland-satellite-unstable": "xwayland-satellite-unstable" @@ -142,6 +140,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1735291276, + "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "634fd46801442d760e09493a794c4f15db2d0cbb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1734119587, "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", @@ -157,7 +171,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1731245184, "narHash": "sha256-vmLS8+x+gHRv1yzj3n+GTAEObwmhxmkkukB2DwtJRdU=", @@ -179,7 +193,7 @@ "home-manager": "home-manager", "impermanence": "impermanence", "niri": "niri", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_4" } }, "xwayland-satellite-stable": { diff --git a/flake.nix b/flake.nix index 33a9a13..ea73bdb 100644 --- a/flake.nix +++ b/flake.nix @@ -8,15 +8,13 @@ impermanence.url = "github:nix-community/impermanence"; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + home-manager.url = "github:nix-community/home-manager"; niri.url = "github:sodiboo/niri-flake"; }; outputs = { nixpkgs, ... }@inputs: + # TODO: Move to utils.nix. let list-nix-directory = dir: builtins.attrNames (nixpkgs.lib.filterAttrs @@ -58,7 +56,7 @@ ({ config, lib, ... }: { users.users = (lib.mapAttrs - (k: v: (import ./users/${k}).systemUser) + (k: v: (import ./users/${k}).systemConfiguration) (lib.filterAttrs (k: _v: builtins.elem k config.sydnix.users.users) (builtins.readDir ./users))); @@ -85,14 +83,19 @@ inputs.home-manager.nixosModules.home-manager ({ config, lib, self, ... }: { home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; + # home-manager.useUserPackages = true; home-manager.users = lib.filterAttrs (k: _v: builtins.elem k config.sydnix.users.users) self.homeConfigurations; - home-manager.extraSpecialArgs = inputs // { inherit self; }; + home-manager.extraSpecialArgs = { + utils = import ./lib/utils.nix { + inherit config lib; + pkgs = nixpkgs; + }; + }; }) ]; }; @@ -103,9 +106,10 @@ homeConfigurations = let users = builtins.readDir ./users; mkUser = username: _v: { - # TODO: This is very ad-hoc, and I don't like it. Organise this better. + # TODO: This is very ad-hoc, and I don't like it. Organise this + # better. imports = [ - (import ./users/${username}).home + (import ./users/${username}/default.nix).homeConfiguration inputs.self.homeManagerModules.default diff --git a/hosts/nixos-testbed/configuration.nix b/hosts/nixos-testbed/configuration.nix index 9d99eb9..91490c6 100644 --- a/hosts/nixos-testbed/configuration.nix +++ b/hosts/nixos-testbed/configuration.nix @@ -46,6 +46,21 @@ }; }; + # HACK: This is here temporarily so I can use `/persist` without + # Impermanence. This can be removed once impermanence is enabled. + systemd.tmpfiles.settings = { + "10-persist" = { + # Permit members of `cfg.persistGroupName` to read, write, and execute + # /persist. + "/persist" = { + z = { + group = "persist"; + mode = "2775"; + }; + }; + }; + }; + # networking.hostName = "nixos-testbed"; networking.hostId = "238e9b1e"; # head -c 8 /etc/machine-id diff --git a/lib/utils.nix b/lib/utils.nix new file mode 100644 index 0000000..1273aea --- /dev/null +++ b/lib/utils.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: + +{ + mkMutableSymlink = + relativePath: + lib.mkMutableSymlink (config.sydnix.configDir + relativePath); + + listNixFilesInDirectory = dir: + builtins.attrNames + (pkgs.lib.filterAttrs + (k: _v: pkgs.lib.hasSuffix ".nix" k) + (builtins.readDir dir)); +} diff --git a/users/crumb/default.nix b/users/crumb/default.nix index 05dd682..ea5632d 100644 --- a/users/crumb/default.nix +++ b/users/crumb/default.nix @@ -1,32 +1,13 @@ { - systemUser = { + systemConfiguration = { isNormalUser = true; extraGroups = [ "wheel" "persist" ]; # Change this immediately after installation! initialPassword = "password123"; }; - home = { config, lib, pkgs, ... }: { - sydnix.impermanence = { - enable = false; - - directories = [ - # ".ssh" - # ".config/systemd" - ]; - - mutableDotfiles = { - enable = false; - # files = [ - # "nvim/.config/nvim/init.vim" - # "nvim/.vimrc" - # ]; - # directories = [ - # "qtile" - # ]; - }; - }; - + homeConfiguration = { config, lib, pkgs, ... }: { + imports = [ ./programs.nix ]; home = { stateVersion = "18.09"; packages = [ diff --git a/users/crumb/dots/nvim/.config/nvim/init.vim b/users/crumb/dots/nvim/.config/nvim/init.vim deleted file mode 100644 index 94cf319..0000000 --- a/users/crumb/dots/nvim/.config/nvim/init.vim +++ /dev/null @@ -1 +0,0 @@ -so ~/.vimrc diff --git a/users/crumb/dots/nvim/.vimrc b/users/crumb/dots/nvim/.vimrc deleted file mode 100644 index 489ba40..0000000 --- a/users/crumb/dots/nvim/.vimrc +++ /dev/null @@ -1,2 +0,0 @@ -imap jk -xmap JK diff --git a/users/crumb/programs.nix b/users/crumb/programs.nix new file mode 100644 index 0000000..86c7ad7 --- /dev/null +++ b/users/crumb/programs.nix @@ -0,0 +1,7 @@ +{ config, lib, pkgs, utils, ... }: + +{ + imports = + map (x: ./programs/${x}) + (utils.listNixFilesInDirectory ./programs); +} diff --git a/users/crumb/programs/nvim.nix b/users/crumb/programs/nvim.nix new file mode 100644 index 0000000..69fd5a2 --- /dev/null +++ b/users/crumb/programs/nvim.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: + +{ + home.file.".vimrc".text = '' + imap jk + xmap JK + ''; + + xdg.configFile."nvim/init.vim".text = '' + so ~/.vimrc + ''; +}