From 2d5ee6c62123d0dd2f0ac4763411b10936cff934 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 1 Nov 2024 14:51:13 +0100 Subject: [PATCH] flake: get rid of flake-parts! --- flake.lock | 39 +--------- flake.nix | 24 ++---- hosts/default.nix | 91 +++++++++-------------- hosts/temperance/programs.nix | 12 +-- modules/options/usrEnv/desktop.nix | 1 - modules/programs/editors/helix/module.nix | 4 +- modules/programs/gui/spicetify.nix | 3 +- modules/services/dunst.nix | 1 - modules/services/greetd.nix | 1 - modules/style/quickshell/module.nix | 6 +- modules/wms/wayland/hyprland/module.nix | 3 +- 11 files changed, 58 insertions(+), 127 deletions(-) diff --git a/flake.lock b/flake.lock index a56da47..291a53b 100644 --- a/flake.lock +++ b/flake.lock @@ -119,24 +119,6 @@ } }, "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "schizofox", @@ -157,9 +139,9 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_2": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { "lastModified": 1698882062, @@ -655,18 +637,6 @@ } }, "nixpkgs-lib": { - "locked": { - "lastModified": 1727825735, - "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" - } - }, - "nixpkgs-lib_2": { "locked": { "dir": "lib", "lastModified": 1698611440, @@ -794,7 +764,6 @@ }, "root": { "inputs": { - "flake-parts": "flake-parts", "helix": "helix", "home-manager": "home-manager", "hyprland": "hyprland", @@ -834,7 +803,7 @@ "schizofox": { "inputs": { "flake-compat": "flake-compat_2", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts", "home-manager": "home-manager_2", "nixpak": "nixpak", "nixpkgs": [ @@ -860,7 +829,7 @@ "searx-randomizer": { "inputs": { "crane": "crane_2", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_2", "nixpkgs": [ "schizofox", "nixpkgs" diff --git a/flake.nix b/flake.nix index 99c3aa9..7d74cc4 100644 --- a/flake.nix +++ b/flake.nix @@ -2,29 +2,19 @@ description = "My NixOS config flake"; outputs = inputs: let pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; - in - inputs.flake-parts.lib.mkFlake {inherit inputs;} { - systems = ["x86_64-linux"]; - imports = [ - ./hosts - ./parts - ]; - flake = { - formatter.x86_64-linux = pkgs.alejandra; - nixosModules = { - shell = import ./modules/shell; - }; - }; + in { + nixosConfigurations = import ./hosts inputs; + formatter.x86_64-linux = pkgs.alejandra; + devShells.x86_64-linux.default = pkgs.callPackage ./shell.nix {}; + nixosModules = { + shell = import ./modules/shell; }; + }; inputs = { - # what am I doing to this config help - flake-parts.url = "github:hercules-ci/flake-parts"; # Unstable nixpkgs baby! nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; - # Lix, a faster nix fork. lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz"; diff --git a/hosts/default.nix b/hosts/default.nix index 776ca81..6d1b2d1 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,12 +1,6 @@ -{ - withSystem, - inputs, - ... -}: let +inputs: let inherit (inputs) self; - inherit (self) lib; - # inherit (lib.extendedLib.builders) mkSystem; - # inherit (lib.extendedLib.modules) mkModuleTree'; + inherit (inputs.nixpkgs) lib; inherit (lib.lists) concatLists flatten singleton; inherit (lib) mkDefault nixosSystem recursiveUpdate; inherit (builtins) filter map toString; @@ -16,59 +10,48 @@ # to be quite a sane way of managing all modules in my flake. mkSystem = { - withSystem, system, hostname, ... } @ args: - withSystem system ( - { - inputs', - self', - ... - }: - nixosSystem { + nixosSystem { + inherit system; + specialArgs = + recursiveUpdate + { inherit system; - specialArgs = - recursiveUpdate - { - inherit lib; - inherit inputs inputs'; - inherit self self'; - } - (args.specialArgs or {}); - modules = concatLists [ - # This is used to pre-emptively set the hostPlatform for nixpkgs. - # Also, we set the system hostname here. - (singleton { - networking.hostName = args.hostname; - nixpkgs.hostPlatform = mkDefault args.system; - }) - (flatten ( - concatLists [ - (singleton ./${hostname}/default.nix) - ( - filter (hasSuffix "module.nix") ( - map toString (listFilesRecursive ../modules) - ) - ) - ] - )) - ]; + inherit lib; + inherit inputs; + inherit self; } - ); + (args.specialArgs or {}); + modules = concatLists [ + # This is used to pre-emptively set the hostPlatform for nixpkgs. + # Also, we set the system hostname here. + (singleton { + networking.hostName = args.hostname; + nixpkgs.hostPlatform = mkDefault args.system; + }) + (flatten ( + concatLists [ + (singleton ./${hostname}/default.nix) + ( + filter (hasSuffix "module.nix") ( + map toString (listFilesRecursive ../modules) + ) + ) + ] + )) + ]; + }; in { - flake.nixosConfigurations = { - temperance = mkSystem { - inherit withSystem; - system = "x86_64-linux"; - hostname = "temperance"; - }; + temperance = mkSystem { + system = "x86_64-linux"; + hostname = "temperance"; + }; - hermit = mkSystem { - inherit withSystem; - system = "x86_64-linux"; - hostname = "hermit"; - }; + hermit = mkSystem { + system = "x86_64-linux"; + hostname = "hermit"; }; } diff --git a/hosts/temperance/programs.nix b/hosts/temperance/programs.nix index 3e7c555..fce1732 100644 --- a/hosts/temperance/programs.nix +++ b/hosts/temperance/programs.nix @@ -1,10 +1,4 @@ -{ - inputs', - pkgs, - ... -}: let - inherit (inputs'.nixpkgs-stable.legacyPackages) calibre; -in { +{pkgs, ...}: { environment.systemPackages = with pkgs; [ alsa-utils @@ -12,6 +6,7 @@ in { asciinema cachix calc + calibre difftastic element-desktop evince @@ -63,6 +58,5 @@ in { xournalpp zapzap zoxide - ] - ++ [calibre]; + ]; } diff --git a/modules/options/usrEnv/desktop.nix b/modules/options/usrEnv/desktop.nix index 23de25f..193f6cb 100644 --- a/modules/options/usrEnv/desktop.nix +++ b/modules/options/usrEnv/desktop.nix @@ -1,5 +1,4 @@ { - inputs', config, pkgs, lib, diff --git a/modules/programs/editors/helix/module.nix b/modules/programs/editors/helix/module.nix index e6b1286..dd53d06 100644 --- a/modules/programs/editors/helix/module.nix +++ b/modules/programs/editors/helix/module.nix @@ -1,6 +1,6 @@ { config, - inputs', + inputs, lib, pkgs, ... @@ -8,7 +8,7 @@ cfg = config.modules.system.programs.editors.helix; inherit (config.modules.other.system) username; inherit (lib) mkIf getExe; - inherit (inputs'.helix.packages) helix; + inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix; wrapped-helix = pkgs.symlinkJoin { name = "helix-wrapped"; paths = with pkgs; [ diff --git a/modules/programs/gui/spicetify.nix b/modules/programs/gui/spicetify.nix index 1a75a0f..b801df6 100644 --- a/modules/programs/gui/spicetify.nix +++ b/modules/programs/gui/spicetify.nix @@ -1,10 +1,9 @@ { inputs, - inputs', pkgs, ... }: let - spicePkgs = inputs'.spicetify-nix.legacyPackages; + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system}; in { imports = [ inputs.spicetify-nix.nixosModules.default diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index 7f0aa97..7beb8b4 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -1,6 +1,5 @@ { config, - inputs', lib, pkgs, ... diff --git a/modules/services/greetd.nix b/modules/services/greetd.nix index 34d7848..0f9ee72 100644 --- a/modules/services/greetd.nix +++ b/modules/services/greetd.nix @@ -1,6 +1,5 @@ { config, - inputs', lib, pkgs, ... diff --git a/modules/style/quickshell/module.nix b/modules/style/quickshell/module.nix index b0ac8f2..0910c21 100644 --- a/modules/style/quickshell/module.nix +++ b/modules/style/quickshell/module.nix @@ -1,11 +1,11 @@ { config, lib, - inputs', + inputs, pkgs, ... }: let - inherit (inputs') quickshell; + inherit (inputs) quickshell; inherit (lib.generators) toKeyValue; inherit (config.meta.mainUser) username; in { @@ -13,7 +13,7 @@ in { home.packages = with pkgs; [ qt6.qtimageformats # amog qt6.qt5compat # shader fx - (quickshell.packages.default.override { + (quickshell.packages.x86_64-linux.default.override { withJemalloc = true; withQtSvg = true; withX11 = true; diff --git a/modules/wms/wayland/hyprland/module.nix b/modules/wms/wayland/hyprland/module.nix index f73f6e8..3209299 100644 --- a/modules/wms/wayland/hyprland/module.nix +++ b/modules/wms/wayland/hyprland/module.nix @@ -2,12 +2,11 @@ config, pkgs, lib, - inputs', ... }: let cfg = config.modules.usrEnv.desktops.hyprland; inherit (config.meta.mainUser) username; - inherit (inputs'.hyprsplit.packages) hyprsplit; + # inherit (inputs.hyprsplit.packages.${pkgs.system}) hyprsplit; inherit (lib) mkIf mkDefault; in { imports = [