Pi66

walrs
pywal but if its Fast-Minimal-Simple
git clone https://git.pi66.xyz/walrs

← back to log

fix support in nix

author: pixel2175
date: 2025-06-05 20:10
hash: 45f3b15c1903b292ec712dfccf06589cff654932

Diffstat:

M

Makefile
19 +++++++-----------

M

flake.nix
31 ++++++++++++++++++++++++++++--
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff --git a/Makefile b/Makefile
index 56a5207..975f357 100644
--- a/Makefile
+++ b/Makefile
@@ -14,20 +14,15 @@ install: build
    sudo install -m644 walrs.1 /usr/share/man/man1/
    bash ./autocomplete.sh

-nix: build
-   install -Dm755 target/release/walrs $(PREFIX)/bin/walrs
-   mkdir -p <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo stretchy="false">&#x00028;</mo><mi>P</mi><mi>R</mi><mi>E</mi><mi>F</mi><mi>I</mi><mi>X</mi><mo stretchy="false">&#x00029;</mo><mo>&#x0002F;</mo><mi>e</mi><mi>t</mi><mi>c</mi><mo>&#x0002F;</mo><mi>w</mi><mi>a</mi><mi>l</mi><mi>r</mi><mi>s</mi><mo>&#x0002F;</mo><mi>t</mi><mi>e</mi><mi>m</mi><mi>p</mi><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi><mi>s</mi><mo>&#x0002F;</mo></mrow></math>(PREFIX)/etc/walrs/scripts/ $(PREFIX)/etc/walrs/colorschemes/
-   cp -r templates/* $(PREFIX)/etc/walrs/templates/
-   cp -r scripts/* $(PREFIX)/etc/walrs/scripts/
-   cp -r colorschemes/* $(PREFIX)/etc/walrs/colorschemes/
-   install -Dm644 walrs.1 $(PREFIX)/share/man/man1/
-   bash ./autocomplete.sh
-
-uninstall:
-   sudo rm -rf /usr/bin/walrs /etc/walrs ~/.config/walrs/ /usr/share/man/man1/walrs.1

-clean:
+nix:
+   nix build
+   sudo cp ./result/bin/walrs /usr/bin/walrs
+   sudo mkdir -p /etc/walrs
+   sudo cp -r ./result/etc/walrs/* /etc/walrs/
+   sudo cp ./result/share/man/man1/walrs.1 /usr/share/man/man1/walrs.1clean:
    cargo clean

+
 .PHONY: all build install uninstall clean nix

diff --git a/flake.nix b/flake.nix
index 215226c..41b2498 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,7 +15,6 @@
           src = ./.;

           cargoHash = "sha256-ItjbG/fPAW1mDJI5JXZ73L4c3UeDZzjBdADsyWhqzm8=";         
-
           nativeBuildInputs = with pkgs; [ bash ];

           # Allow unstable Rust features
@@ -23,8 +22,9 @@
             export RUSTC_BOOTSTRAP=1
           '';

-          # Let rustPlatform handle the binary, we just add the extra files
+          # Install everything to the Nix store first
           postInstall = ''
+            # Install config files to result/
             mkdir -p $out/etc/walrs/{templates,scripts,colorschemes}

             if [ -d "templates" ]; then
@@ -37,6 +37,7 @@
               cp -r colorschemes/* $out/etc/walrs/colorschemes/ || true
             fi

+            # Install man page
             if [ -f "walrs.1" ]; then
               install -Dm644 walrs.1 $out/share/man/man1/walrs.1
             fi
@@ -48,5 +49,31 @@
             homepage = "https://github.com/pixel2175/walrs";
           };
         };
+        
+        # Create installer that copies from result/ to system locations
+        packages.install-system = pkgs.writeShellScriptBin "walrs-install-system" ''
+          set -e
+          WALRS_PACKAGE="<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mrow><mi>s</mi><mi>e</mi><mi>l</mi><mi>f</mi><mo>&#x0002E;</mo><mi>p</mi><mi>a</mi><mi>c</mi><mi>k</mi><mi>a</mi><mi>g</mi><mi>e</mi><mi>s</mi><mo>&#x0002E;</mo></mrow></mrow></math>{system}.default}"
+          
+          echo "Installing walrs from Nix store to system locations..."
+          
+          # Install binary
+          sudo install -m755 "$WALRS_PACKAGE/bin/walrs" /usr/local/bin/walrs
+          
+          # Install config files from result/etc/walrs/ to /etc/walrs/
+          sudo mkdir -p /etc/walrs
+          if [ -d "$WALRS_PACKAGE/etc/walrs" ]; then
+            sudo cp -r "$WALRS_PACKAGE/etc/walrs"/* /etc/walrs/
+          fi
+          
+          # Install man page
+          if [ -f "$WALRS_PACKAGE/share/man/man1/walrs.1" ]; then
+            sudo install -Dm644 "$WALRS_PACKAGE/share/man/man1/walrs.1" /usr/share/man/man1/walrs.1
+          fi
+          
+          echo "✓ walrs installed to /usr/local/bin/walrs"
+          echo "✓ Configuration files installed to /etc/walrs/"
+          echo "✓ Man page installed to /usr/share/man/man1/walrs.1"
+        '';
       });
 }