From 1062369a781356cedd5a59565fd310d7be0c6fff Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:17:39 -0500 Subject: [PATCH] more moving around --- flake.lock | 17 ------ flake.nix | 52 ++++++++++--------- hosts/darwin/default.nix | 16 ++++++ hosts/{ => darwin}/lookingglass/default.nix | 0 hosts/default.nix | 4 +- hosts/nixos/default.nix | 20 +++++++ hosts/{ => nixos}/flame/default.nix | 0 hosts/{ => nixos}/swan/default.nix | 0 hosts/{ => nixos}/tempest/default.nix | 0 pkgs/misc/wallpapers/package.nix | 21 +++++--- .../modules/nmasur/presets/services/i3.nix | 1 + .../nmasur/presets/services/lightdm.nix | 3 +- 12 files changed, 81 insertions(+), 53 deletions(-) create mode 100644 hosts/darwin/default.nix rename hosts/{ => darwin}/lookingglass/default.nix (100%) create mode 100644 hosts/nixos/default.nix rename hosts/{ => nixos}/flame/default.nix (100%) rename hosts/{ => nixos}/swan/default.nix (100%) rename hosts/{ => nixos}/tempest/default.nix (100%) diff --git a/flake.lock b/flake.lock index 646c4ec..d9e733d 100644 --- a/flake.lock +++ b/flake.lock @@ -557,7 +557,6 @@ "tree-sitter-python": "tree-sitter-python", "tree-sitter-rasi": "tree-sitter-rasi", "tree-sitter-vimdoc": "tree-sitter-vimdoc", - "wallpapers": "wallpapers", "wsl": "wsl", "zenyd-mpv-scripts": "zenyd-mpv-scripts" } @@ -810,22 +809,6 @@ "type": "github" } }, - "wallpapers": { - "flake": false, - "locked": { - "lastModified": 1657544922, - "narHash": "sha256-1c1uDz37MhksWC75myv6jao5q2mIzD8X8I+TykXXmWg=", - "owner": "exorcist365", - "repo": "wallpapers", - "rev": "8d2860ac6c05cec0f78d5c9d07510f4ff5da90dc", - "type": "gitlab" - }, - "original": { - "owner": "exorcist365", - "repo": "wallpapers", - "type": "gitlab" - } - }, "wsl": { "inputs": { "flake-compat": "flake-compat_2", diff --git a/flake.nix b/flake.nix index 1610b92..038c19e 100644 --- a/flake.nix +++ b/flake.nix @@ -52,11 +52,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # Wallpapers - wallpapers = { - url = "gitlab:exorcist365/wallpapers"; - flake = false; - }; + # # Wallpapers + # wallpapers = { + # url = "gitlab:exorcist365/wallpapers"; + # flake = false; + # }; # Used to generate NixOS images for other platforms nixos-generators = { @@ -295,9 +295,9 @@ inputs.wsl.nixosModules.wsl ./platforms/nixos ]; - specialArgs = { - wallpapers = inputs.wallpapers; - }; + # specialArgs = { + # wallpapers = inputs.wallpapers; + # }; }; buildDarwin = @@ -320,7 +320,8 @@ # Create nixosConfigurations using the different pkgs for each system # What to do with home config? - nixosModules = import ./hosts/x86_64-linux nixpkgs // import ./hosts/aarch64-linux nixpkgs; + nixosModules = import ./hosts/nixos nixpkgs; + darwinModules = import ./hosts/darwin nixpkgs; # Contains my full system builds, including home-manager # nixos-rebuild switch --flake .#tempest @@ -350,24 +351,27 @@ # Contains my full Mac system builds, including home-manager # darwin-rebuild switch --flake .#lookingglass - darwinConfigurations = builtins.mapAttrs buildDarwin { - pkgs = pkgsBySystem.aarch64-darwin; - modules = import ./hosts/darwin; - }; + darwinConfigurations = builtins.mapAttrs ( + name: module: + buildDarwin { + pkgs = pkgsBySystem.aarch64-darwin; + modules = [ module ]; + } + ) darwinModules; + # darwinConfigurations = builtins.mapAttrs buildDarwin { + # pkgs = pkgsBySystem.aarch64-darwin; + # modules = import ./hosts/darwin; + # }; # For quickly applying home-manager settings with: # home-manager switch --flake .#tempest - homeConfigurations = rec { - default = personal; - work = buildHome { - pkgs = pkgsBySystem.aarch64-darwin; - modules = { }; - }; - personal = buildHome { - }; - tempest = nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home; - lookingglass = darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home; - }; + homeConfigurations = builtins.mapAttrs ( + name: module: + buildHome { + pkgs = pkgsBySystem.x86_64-linux; + module = [ module ]; + } + ) nixosModules; # Disk formatting, only used once diskoConfigurations = { diff --git a/hosts/darwin/default.nix b/hosts/darwin/default.nix new file mode 100644 index 0000000..2303757 --- /dev/null +++ b/hosts/darwin/default.nix @@ -0,0 +1,16 @@ +# Return a list of all nix-darwin hosts + +{ lib, ... }: + +lib.pipe (lib.filesystem.listFilesRecursive ./.) [ + # Get only files ending in default.nix + (builtins.filter (name: lib.hasSuffix "default.nix" name)) + # Import each host function + map + (file: { + name = builtins.baseNameOf (builtins.dirOf file); + value = import file; + }) + # Convert to an attrset of hostname -> host function + (builtins.listToAttrs) +] diff --git a/hosts/lookingglass/default.nix b/hosts/darwin/lookingglass/default.nix similarity index 100% rename from hosts/lookingglass/default.nix rename to hosts/darwin/lookingglass/default.nix diff --git a/hosts/default.nix b/hosts/default.nix index 6d65e57..1b63d3b 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,6 +1,6 @@ # Return a list of all hosts { - darwin-hosts = import ./aarch64-darwin; - linux-hosts = import ./x86_64-linux // import ./aarch64-linux; + darwin-hosts = import ./darwin; + linux-hosts = import ./nixos; } diff --git a/hosts/nixos/default.nix b/hosts/nixos/default.nix new file mode 100644 index 0000000..24b0b2f --- /dev/null +++ b/hosts/nixos/default.nix @@ -0,0 +1,20 @@ +# Return a list of all NixOS hosts + +{ nixpkgs, ... }: + +let + inherit (nixpkgs) lib; +in + +lib.pipe (lib.filesystem.listFilesRecursive ./.) [ + # Get only files ending in default.nix + (builtins.filter (name: lib.hasSuffix "default.nix" name)) + # Import each host function + map + (file: { + name = builtins.baseNameOf (builtins.dirOf file); + value = import file; + }) + # Convert to an attrset of hostname -> host function + (builtins.listToAttrs) +] diff --git a/hosts/flame/default.nix b/hosts/nixos/flame/default.nix similarity index 100% rename from hosts/flame/default.nix rename to hosts/nixos/flame/default.nix diff --git a/hosts/swan/default.nix b/hosts/nixos/swan/default.nix similarity index 100% rename from hosts/swan/default.nix rename to hosts/nixos/swan/default.nix diff --git a/hosts/tempest/default.nix b/hosts/nixos/tempest/default.nix similarity index 100% rename from hosts/tempest/default.nix rename to hosts/nixos/tempest/default.nix diff --git a/pkgs/misc/wallpapers/package.nix b/pkgs/misc/wallpapers/package.nix index a0ed316..484d398 100644 --- a/pkgs/misc/wallpapers/package.nix +++ b/pkgs/misc/wallpapers/package.nix @@ -1,10 +1,15 @@ { pkgs, ... }: -pkgs. - -pkgs.writeShellApplication - { - name = "ocr"; - runtimeInputs = [ pkgs.tesseract ]; - text = builtins.readFile ./ocr.sh; - } +pkgs.stdenv.mkDerivation { + pname = "wallpapers"; + version = "0.1"; + src = pkgs.fetchFromGitLab { + owner = "exorcist365"; + repo = "wallpapers"; + rev = "8d2860ac6c05cec0f78d5c9d07510f4ff5da90dc"; + sha256 = "155lb7w563dk9kdn4752hl0zjhgnq3j4cvs9z98nb25k1xpmpki7"; + }; + installPhase = '' + cp -r $src/ $out/ + ''; +} diff --git a/platforms/home-manager/modules/nmasur/presets/services/i3.nix b/platforms/home-manager/modules/nmasur/presets/services/i3.nix index 05ff1a9..96d8d3f 100644 --- a/platforms/home-manager/modules/nmasur/presets/services/i3.nix +++ b/platforms/home-manager/modules/nmasur/presets/services/i3.nix @@ -20,6 +20,7 @@ in wallpaper = { type = lib.types.path; description = "Wallpaper background image file"; + default = "${pkgs.wallpapers}/gruvbox/road.jpg"; }; commands = { launcher = lib.mkOption { diff --git a/platforms/nixos/modules/nmasur/presets/services/lightdm.nix b/platforms/nixos/modules/nmasur/presets/services/lightdm.nix index df0953d..c078258 100644 --- a/platforms/nixos/modules/nmasur/presets/services/lightdm.nix +++ b/platforms/nixos/modules/nmasur/presets/services/lightdm.nix @@ -2,7 +2,6 @@ config, pkgs, lib, - wallpapers ? null, ... }: @@ -17,7 +16,7 @@ in wallpaper = { type = lib.types.nullOr lib.types.path; description = "Wallpaper background image file"; - default = "${wallpapers}/gruvbox/road.jpg"; + default = "${pkgs.wallpapers}/gruvbox/road.jpg"; }; gtk.theme = { name = lib.mkOption {