From 6f79c94f1158e468b57bd0e92ab2540e3e57d85c Mon Sep 17 00:00:00 2001 From: Artur Manuel Date: Sun, 2 Feb 2025 16:37:47 +0000 Subject: [PATCH] refactor(flake): refactor lib for flake-parts --- flake.lock | 40 +++++++------- flake.nix | 7 ++- hosts/default.nix | 2 +- hosts/python/users/default.nix | 7 ++- hosts/python/wrappers/foot/foot.ini | 4 +- lib/default.nix | 81 +++++++++++++++-------------- 6 files changed, 70 insertions(+), 71 deletions(-) diff --git a/flake.lock b/flake.lock index 7a3a23f..0501a95 100644 --- a/flake.lock +++ b/flake.lock @@ -9,11 +9,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1738328739, - "narHash": "sha256-LHxIpDEsQ1MoIeAJSuUznJWLzFhceUPcCb8x1mRe/Fk=", + "lastModified": 1738499276, + "narHash": "sha256-w1DEom//LsBM+hQ7PO5p4tpTE7yBmW05Rgw94uPkIUY=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "61b2c985f6b4e07a7f2c44928a0e45fe6315ed96", + "rev": "316741ee3d1b0f6baea9af0f177db26455bf728b", "type": "github" }, "original": { @@ -100,11 +100,11 @@ "nixpkgs-lib": ["nixpkgs"] }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", "type": "github" }, "original": { @@ -314,11 +314,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1738142207, - "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { @@ -374,11 +374,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1738142207, - "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { @@ -615,11 +615,11 @@ "nvf": "nvf" }, "locked": { - "lastModified": 1738191670, - "narHash": "sha256-9FdrtLQvXKKsWwu1jLQrV0UnC54+9HBkfs1h2a8XlcM=", + "lastModified": 1738465927, + "narHash": "sha256-HWfSQMxa4Cpxyo44cY3Y4OzsBu4etaeejsENUjUHUss=", "ref": "master", - "rev": "dbc066fed939618282f1f079ddc5b4d5e89c39a7", - "revCount": 20, + "rev": "841cddc0a522974439fe3332233ff334b7309e96", + "revCount": 21, "type": "git", "url": "https://codeberg.org/amadaluzia/painless-neovim.git" }, @@ -3444,16 +3444,16 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1738363663, - "narHash": "sha256-e3OQX21urTH68U80oL4PxIIISD6LuI1aJa62YNCPAZM=", + "lastModified": 1738503390, + "narHash": "sha256-k+lXb31oXWD2Sc8/+F4Tw9IAOEvi14e3hnx/hpBSbcE=", "owner": "amadaluzia", "repo": "wallpkgs", - "rev": "c0e09f07d46e3fe51e8198fee9003ac3ed282fbe", + "rev": "bd56d6c493bc7338000842663b07362085fc1462", "type": "github" }, "original": { "owner": "amadaluzia", - "ref": "nord", + "ref": "docs-fixup", "repo": "wallpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 3690c7f..d2c3490 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ type = "github"; owner = "amadaluzia"; repo = "wallpkgs"; - ref = "nord"; + ref = "docs-fixup"; inputs.nixpkgs.follows = "nixpkgs"; }; pankomacs = { @@ -67,11 +67,10 @@ }; outputs = inputs @ { self, - nixpkgs, flake-parts, ... }: let - lib = nixpkgs.lib.extend (import ./lib {inherit inputs self;}); + inherit ((import ./lib {inherit inputs self;}).flake) lib; in flake-parts.lib.mkFlake { inherit inputs; @@ -82,7 +81,7 @@ ./hosts ./overlays ./shells + ./lib ]; - flake = {inherit lib;}; }; } diff --git a/hosts/default.nix b/hosts/default.nix index 6f7d8b4..b4cf458 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -4,7 +4,7 @@ ... }: { flake = { - nixosConfigurations = lib.mkHosts { + nixosConfigurations = builtins.mapAttrs (n: v: lib.mkHost (v // {host = n;})) { python = { system = "x86_64-linux"; extraModules = [ diff --git a/hosts/python/users/default.nix b/hosts/python/users/default.nix index 5f5808b..6c6684a 100644 --- a/hosts/python/users/default.nix +++ b/hosts/python/users/default.nix @@ -8,13 +8,12 @@ tmpfiles = { ".config/qutebrowser/config.py" = ./configs/qutebrowser/config.py; ".config/qutebrowser/theme" = ./configs/qutebrowser/theme; - ".config/vesktop/themes/system24.theme.css" = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/refact0r/system24/refs/heads/main/theme/system24.theme.css"; - hash = "sha256-WJYNWeo1DdgOh7cFne6QSEHQagqapFznqWfeoCsqM+8="; + ".config/vesktop/themes/theme.user.css" = pkgs.fetchurl { + url = "https://github.com/deathbeam/base16-discord/raw/refs/heads/main/themes/base16-nord.theme.css"; + hash = "sha256-LofqgsVl+XKisk/dmb/PpwuLEWdEgchIfIw4xZs6LQw="; }; ".config/vesktop/settings/quickCss.css" = ./configs/vesktop/quickCss.css; ".config/kanshi/" = ./configs/kanshi; - ".config/kitty/" = ./configs/kitty; ".config/dunst/" = ./configs/dunst; ".config/niri/" = ./configs/niri; }; diff --git a/hosts/python/wrappers/foot/foot.ini b/hosts/python/wrappers/foot/foot.ini index 11afcd5..6ccef48 100644 --- a/hosts/python/wrappers/foot/foot.ini +++ b/hosts/python/wrappers/foot/foot.ini @@ -1,6 +1,6 @@ [main] -pad=6x6 -font=monospace:size=15 +pad=8x8 +font=monospace:size=13 [colors] foreground=e5e9f0 diff --git a/lib/default.nix b/lib/default.nix index 27206b0..0a02007 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,47 +1,48 @@ { inputs, self, -}: _: _: let - mkHost = { - host, - system, - extraModules ? [], - }: - inputs.nixpkgs.lib.nixosSystem { - inherit system; - modules = - extraModules - ++ [ - ../hosts/${host} - inputs.self.nixosModules.default - ({config, ...}: { - config = { - nix = { - settings.extra-experimental-features = [ - "nix-command" - "flakes" - ]; - gc = { - automatic = true; - dates = "weekly"; + ... +}: { + flake.lib = inputs.nixpkgs.lib.extend (_: _: { + mkHost = { + host, + system, + extraModules ? [], + }: + inputs.nixpkgs.lib.nixosSystem { + inherit system; + modules = + extraModules + ++ [ + ../hosts/${host} + inputs.self.nixosModules.default + ({config, ...}: { + config = { + nix = { + settings.extra-experimental-features = [ + "nix-command" + "flakes" + ]; + gc = { + automatic = true; + dates = "weekly"; + }; }; + nixpkgs.config.allowUnfree = true; + environment.shellAliases = { + rebs = "nixos-rebuild --use-remote-sudo switch --flake .#${host}"; + rebt = "nixos-rebuild --use-remote-sudo test --flake .#${host}"; + }; + nixpkgs.overlays = [ + inputs.self.overlays.default + ]; + networking.hostName = host; }; - nixpkgs.config.allowUnfree = true; - environment.shellAliases = { - rebs = "nixos-rebuild --use-remote-sudo switch --flake .#${host}"; - rebt = "nixos-rebuild --use-remote-sudo test --flake .#${host}"; - }; - nixpkgs.overlays = [ - inputs.self.overlays.default - ]; - networking.hostName = host; - }; - }) - ]; - specialArgs = { - inherit inputs self; + }) + ]; + specialArgs = { + inherit inputs self; + }; }; - }; -in { - mkHosts = builtins.mapAttrs (n: v: mkHost (v // {host = n;})); + }); }