From b439ce59d01252def2860fadd53a665edc097867 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Thu, 2 Jun 2022 18:18:20 +0200 Subject: [PATCH] All machines, expose configuration as nixosModules.home-manager --- flake.lock | 14 +++++++------ flake.nix | 41 ++++++++++++++++++++------------------- machines/desktop.nix | 11 +++++------ machines/laptop.nix | 5 ----- machines/pvv-terminal.nix | 5 ----- 5 files changed, 34 insertions(+), 42 deletions(-) diff --git a/flake.lock b/flake.lock index 7dba984..bb5ce3a 100644 --- a/flake.lock +++ b/flake.lock @@ -7,17 +7,19 @@ ] }, "locked": { + "host": "git.dodsorf.as", "lastModified": 1654132489, "narHash": "sha256-7L6gKN5Y2PbjK2aHX2jwOCZfe9R+7RusvuULy9EbKGs=", - "ref": "master", + "owner": "Dandellion", + "repo": "NUR", "rev": "9b6f60ce8a94d8269190dbe4ac9450f87910ac8b", - "revCount": 159, - "type": "git", - "url": "https://git.dodsorf.as/Dandellion/NUR" + "type": "gitlab" }, "original": { - "type": "git", - "url": "https://git.dodsorf.as/Dandellion/NUR" + "host": "git.dodsorf.as", + "owner": "Dandellion", + "repo": "NUR", + "type": "gitlab" } }, "home-manager-2205": { diff --git a/flake.nix b/flake.nix index 95f319a..e603b6b 100644 --- a/flake.nix +++ b/flake.nix @@ -11,33 +11,34 @@ nur.url = "github:nix-community/NUR"; nur.inputs.nixpkgs.follows = "unstable"; - dan.url = "git+https://git.dodsorf.as/Dandellion/NUR"; + dan.url = "gitlab:Dandellion/NUR?host=git.dodsorf.as"; #"git+https://git.dodsorf.as/Dandellion/NUR"; dan.inputs.nixpkgs.follows = "unstable"; }; outputs = {self, home-manager-2205, unstable, nur, dan, ... }: let - pvv-home = "/home/pvv/d/${pvv-username}"; - pvv-username = "danio"; + nixlib = unstable.lib; + + mkHome = + { machine + , hmChannel ? home-manager-2205 + , configuration ? self.nixosModules.home-manager.${machine} + , system ? "x86_64-linux" + , username ? "daniel" + , homeDirectory ? "/home/${username}" + , stateVersion ? "22.05" + , extraSpecialArgs ? { inherit (self) overlays; } + }: + hmChannel.lib.homeManagerConfiguration { + inherit configuration system username homeDirectory stateVersion extraSpecialArgs; + }; in { - homeConfigurations.laptop = home-manager-2205.lib.homeManagerConfiguration { - configuration = import ./machines/laptop.nix; - system = "x86_64-linux"; - username = "daniel"; - homeDirectory = "/home/daniel"; - stateVersion = "22.05"; - extraSpecialArgs = { inherit (self) overlays; }; - }; + homeConfigurations = nixlib.genAttrs [ "laptop" "desktop" ] (machine: mkHome { inherit machine; }) + // nixlib.genAttrs [ "pvv-terminal" ] (machine: mkHome {inherit machine; username = "danio"; homeDirectory = "/home/pvv/d/danio";}); - - homeConfigurations.pvv-terminal = home-manager-2205.lib.homeManagerConfiguration { - configuration = import ./machines/pvv-terminal.nix; - system = "x86_64-linux"; - username = pvv-username; - homeDirectory = pvv-home; - stateVersion = "22.05"; - extraSpecialArgs = { inherit (self) overlays; }; + nixosModules = { + home-manager = nixlib.genAttrs [ "laptop" "desktop" "pvv-terminal" ] (machine: import ./machines/${machine}.nix); }; overlays = [ @@ -50,4 +51,4 @@ nur.overlay ]; }; -} +} \ No newline at end of file diff --git a/machines/desktop.nix b/machines/desktop.nix index 6c1d452..ad946ec 100644 --- a/machines/desktop.nix +++ b/machines/desktop.nix @@ -1,5 +1,9 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, overlays, ... }: { + nixpkgs.overlays = overlays; + nixpkgs.config.allowUnfreePredicate = (pkg: true); + nixpkgs.config.allowUnfree = true; + imports = [ ../profiles ]; machine = { @@ -13,9 +17,4 @@ profiles.zsh.enable = true; profiles.games.enable = true; - - programs.home-manager = { - enable = true; - path = "https://github.com/rycee/home-manager/archive/release-21.11.tar.gz"; - }; } diff --git a/machines/laptop.nix b/machines/laptop.nix index 210d511..be2f8ea 100644 --- a/machines/laptop.nix +++ b/machines/laptop.nix @@ -23,9 +23,4 @@ }; profiles.games.enable = true; - - programs.home-manager = { - enable = true; - path = "https://github.com/rycee/home-manager/archive/release-22.05.tar.gz"; - }; } diff --git a/machines/pvv-terminal.nix b/machines/pvv-terminal.nix index bd4c41f..3d1be62 100644 --- a/machines/pvv-terminal.nix +++ b/machines/pvv-terminal.nix @@ -34,9 +34,4 @@ interval = 10; format = "ﴥ