From b719a7b73199d2b0e24694183daa3714c4cced44 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 30 Aug 2023 14:46:21 +0300 Subject: [PATCH] nix: clean up flake and ignore nix build artifact --- .gitignore | 1 + flake.lock | 18 +++++++++++++++++- flake.nix | 43 +++++++++++++++++++++++++++++++------------ result | 1 - 4 files changed, 49 insertions(+), 14 deletions(-) delete mode 120000 result diff --git a/.gitignore b/.gitignore index 6c2c53c..5a28c86 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build/ .cache/ *.so compile_flags.txt +result/ diff --git a/flake.lock b/flake.lock index 8bf1578..3bcebc9 100644 --- a/flake.lock +++ b/flake.lock @@ -47,6 +47,21 @@ "type": "github" } }, + "nix-filter": { + "locked": { + "lastModified": 1687178632, + "narHash": "sha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "d90c75e8319d0dd9be67d933d8eb9d0894ec9174", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1691654369, @@ -65,7 +80,8 @@ }, "root": { "inputs": { - "hyprland": "hyprland" + "hyprland": "hyprland", + "nix-filter": "nix-filter" } }, "systems": { diff --git a/flake.nix b/flake.nix index 02d93bb..1d27038 100644 --- a/flake.nix +++ b/flake.nix @@ -1,25 +1,44 @@ { inputs = { hyprland.url = "github:hyprwm/Hyprland"; + nix-filter.url = "github:numtide/nix-filter"; }; - outputs = { self, hyprland, ... }: let + outputs = { + self, + hyprland, + nix-filter, + ... + }: let inherit (hyprland.inputs) nixpkgs; - hyprlandSystems = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system}); + forHyprlandSystems = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system}); in { - packages = hyprlandSystems (system: pkgs: rec { + packages = forHyprlandSystems (system: pkgs: rec { split-monitor-workspaces = pkgs.stdenv.mkDerivation { pname = "split-monitor-workspaces"; version = "0.1"; - src = ./.; + src = nix-filter.lib { + root = ./.; + include = [ + "src" + "include" + ./Makefile + ./meson.build + ]; + }; - nativeBuildInputs = with pkgs; [ meson ninja pkg-config ]; + # allow overriding xwayland support + BUILT_WITH_NOXWAYLAND = false; - buildInputs = with pkgs; [ - hyprland.packages.${system}.hyprland.dev - pango - cairo - ] ++ hyprland.packages.${system}.hyprland.buildInputs; + nativeBuildInputs = with pkgs; [meson ninja pkg-config]; + + buildInputs = with pkgs; + [ + hyprland.packages.${system}.hyprland.dev + pango + cairo + ] + ++ hyprland.packages.${system}.hyprland.buildInputs; meta = with pkgs.lib; { homepage = "https://github.com/Duckonaut/split-monitor-workspaces"; @@ -32,7 +51,7 @@ default = split-monitor-workspaces; }); - devShells = hyprlandSystems (system: pkgs: { + devShells = forHyprlandSystems (system: pkgs: { default = pkgs.mkShell { name = "split-monitor-workspaces"; @@ -41,7 +60,7 @@ bear ]; - inputsFrom = [ self.packages.${system}.split-monitor-workspaces ]; + inputsFrom = [self.packages.${system}.split-monitor-workspaces]; }; }); }; diff --git a/result b/result deleted file mode 120000 index c73a762..0000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/bjf217i1id0y2wqsmgrfl7wjbb9f913g-split-monitor-workspaces-0.1 \ No newline at end of file