From 291e7226f8a20893f147810aaa70f50c27f09dc5 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Tue, 12 Nov 2024 21:31:22 -0800 Subject: [PATCH] feat(flake): Switch to flake-parts & nixos-unified --- flake.lock | 51 ++++++++++++++++++++++++-- flake.nix | 77 +++++++++++++++++++++++++--------------- home/appearance/qt.nix | 4 +-- home/default.nix | 10 +++--- home/programs/amfora.nix | 4 +-- 5 files changed, 106 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index 9aad837..d4c255d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -20,6 +38,21 @@ "type": "github" } }, + "nixos-unified": { + "locked": { + "lastModified": 1729697921, + "narHash": "sha256-gqcmWE+4Vr5/l6AoQc2jIbJHCAXAY+qWPC0ruoAHV1Q=", + "owner": "srid", + "repo": "nixos-unified", + "rev": "e60e64841e74c777799624531dcb2f311f95f639", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "nixos-unified", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1730785428, @@ -36,9 +69,23 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1730504152, + "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "home-manager": "home-manager", + "nixos-unified": "nixos-unified", "nixpkgs": "nixpkgs", "rose-pine": "rose-pine", "rose-pine-amfora": "rose-pine-amfora", @@ -53,11 +100,11 @@ "rev": "14b2e2c3f3e1721adb6e8e44f1385b1e9b0d0453", "revCount": 382, "type": "git", - "url": "https://git.punkfairie.net/punkfairie/rose-pine-nix" + "url": "https://codewith.babesonthe.net/punkfairie/rose-pine-nix" }, "original": { "type": "git", - "url": "https://git.punkfairie.net/punkfairie/rose-pine-nix" + "url": "https://codewith.babesonthe.net/punkfairie/rose-pine-nix" } }, "rose-pine-amfora": { diff --git a/flake.nix b/flake.nix index 89defb0..423dc01 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,56 @@ { description = "marleyOS"; + outputs = + { self, ... }@inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + ]; + + imports = [ + inputs.nixos-unified.flakeModules.default + ]; + + flake = { + homeModules.marley = + { pkgs, ... }: + { + imports = [ + inputs.rose-pine.homeManagerModules.rose-pine + ./modules/home/iconTheme.nix + ./modules/home/shellAbbrs.nix + ./home + ]; + }; + }; + + perSystem = + { pkgs, ... }: + let + me = "marley"; + home = if pkgs.stdenv.isDarwin then "Users" else "home"; + inherit (self.nixos-unified.lib) mkHomeConfiguration; + in + { + legacyPackages.homeConfigurations."${me}" = mkHomeConfiguration pkgs ( + { pkgs, ... }: + { + imports = [ self.homeModules."${me}" ]; + home.username = me; + home.homeDirectory = "/${home}/${me}"; + home.stateVersion = "24.05"; + } + ); + + formatter = pkgs.nixfmt-rfc-style; + }; + }; + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixos-unified.url = "github:srid/nixos-unified"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { @@ -22,32 +71,4 @@ flake = false; }; }; - - outputs = - { - nixpkgs, - home-manager, - ... - }@inputs: - { - homeConfigurations."marley" = - let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in - home-manager.lib.homeManagerConfiguration { - inherit pkgs; - - extraSpecialArgs = { - inherit inputs; - }; - - modules = [ - inputs.rose-pine.homeManagerModules.rose-pine - ./modules/home/shellAbbrs.nix - ./modules/home/iconTheme.nix - ./home - ]; - }; - }; } diff --git a/home/appearance/qt.nix b/home/appearance/qt.nix index 564e340..1045c9c 100644 --- a/home/appearance/qt.nix +++ b/home/appearance/qt.nix @@ -1,6 +1,6 @@ -{ inputs, ... }: +{ flake, ... }: { - xdg.configFile."qt5ct/colors/rose-pine.conf".source = "${inputs.rose-pine-qt5ct}/rose-pine.conf"; + xdg.configFile."qt5ct/colors/rose-pine.conf".source = "${flake.inputs.rose-pine-qt5ct}/rose-pine.conf"; qt = { enable = true; diff --git a/home/default.nix b/home/default.nix index a586521..368769a 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,13 +1,10 @@ { pkgs, - # nixgl, + lib, ... }: { - home.username = "marley"; - home.homeDirectory = "/home/marley"; - - targets.genericLinux.enable = true; + targets.genericLinux.enable = lib.mkIf pkgs.stdenv.isLinux true; home.language.base = "en_US.UTF-8"; @@ -56,7 +53,8 @@ # You should not change this value, even if you update Home Manager. If you do # want to update the value, then make sure to first check the Home Manager # release notes. - home.stateVersion = "24.05"; # Please read the comment before changing. + # home.stateVersion = "24.05"; # Please read the comment before changing. + # ((this is set in flake.nix but I wanted to keep the explanation here.)) # Let home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/programs/amfora.nix b/home/programs/amfora.nix index ee7c52e..4265d24 100644 --- a/home/programs/amfora.nix +++ b/home/programs/amfora.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, flake, ... }: { home.packages = with pkgs; [ amfora @@ -8,7 +8,7 @@ # Possibly set this in rose-pine-nix as well? # There is no programs.amfora so it would require adding attl opts to base # rose-pine. - xdg.configFile."amfora/theme.toml".source = "${inputs.rose-pine-amfora}/themes/rose-pine.toml"; + xdg.configFile."amfora/theme.toml".source = "${flake.inputs.rose-pine-amfora}/themes/rose-pine.toml"; # https://github.com/makeworld-the-better-one/amfora/blob/master/default-config.toml # Amfora requires a number of options to run - omitting everything didn't care