Browse Source

nixpkgs: support non x86_64-linux systems

Thomas Dy 1 year ago
parent
commit
927b2ad161

+ 34 - 0
.config/nixpkgs/elvish/flake.lock

@@ -1,5 +1,23 @@
 {
   "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1681202837,
+        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1680303149,
@@ -18,8 +36,24 @@
     },
     "root": {
       "inputs": {
+        "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs"
       }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
     }
   },
   "root": "root",

+ 31 - 35
.config/nixpkgs/elvish/flake.nix

@@ -3,15 +3,13 @@
 
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+    flake-utils.url = "github:numtide/flake-utils";
   };
 
-  outputs = { self, nixpkgs }:
-    {
-      packages.x86_64-linux.carapace-bin =
-        with import nixpkgs {
-          system = "x86_64-linux";
-        };
-        buildGoModule rec {
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      with nixpkgs.legacyPackages.${system}; {
+        packages.carapace-bin = buildGoModule rec {
           pname = "carapace-bin";
           version = "0.24.1";
 
@@ -35,36 +33,34 @@
           vendorSha256 = "sha256-UMRAyUcGxPsW4Q7o5KtXMmdcuY+DEGhbm4jPBVLOLGQ=";
         };
 
-      packages.x86_64-linux.elvish =
-        with import nixpkgs {
-          system = "x86_64-linux";
-        };
-        let
-          carapace-bin = self.packages.x86_64-linux.carapace-bin;
-          config = runCommand "elvish-config" {
-            nativeBuildInputs = [ makeWrapper ];
-          } ''
-            mkdir -p $out/elvish
+        packages.elvish =
+          let
+            carapace-bin = self.packages.${system}.carapace-bin;
+            config = runCommand "elvish-config" {
+              nativeBuildInputs = [ makeWrapper ];
+            } ''
+              mkdir -p $out/elvish
 
-            cp -r ${./lib} $out/elvish/lib
+              cp -r ${./lib} $out/elvish/lib
 
-            cat <<EOF > $out/elvish/rc.elv
-            use config
-            eval (carapace _carapace|slurp)
-            EOF
+              cat <<EOF > $out/elvish/rc.elv
+              use config
+              eval (carapace _carapace|slurp)
+              EOF
+            '';
+          in
+          writeScriptBin "elvish" ''
+            #!/bin/sh
+            export XDG_DATA_DIRS="${config}:$XDG_DATA_DIRS"
+            export PATH="${carapace-bin}/bin:$PATH"
+            if command -v keyctl > /dev/null && [ -z "$KEYCTL_INIT" ]; then
+              export KEYCTL_INIT=1
+              keyctl new_session >/dev/null
+            fi
+            exec ${elvish}/bin/elvish -rc "${config}/elvish/rc.elv" "$@"
           '';
-        in
-        writeScriptBin "elvish" ''
-          #!/bin/sh
-          export XDG_DATA_DIRS="${config}:$XDG_DATA_DIRS"
-          export PATH="${carapace-bin}/bin:$PATH"
-          if [ -z "$KEYCTL_INIT" ]; then
-            export KEYCTL_INIT=1
-            keyctl new_session >/dev/null
-          fi
-          exec ${elvish}/bin/elvish -rc "${config}/elvish/rc.elv" "$@"
-        '';
 
-      packages.x86_64-linux.default = self.packages.x86_64-linux.elvish;
-    };
+        packages.default = self.packages.${system}.elvish;
+      }
+    );
 }

+ 34 - 0
.config/nixpkgs/neovim/flake.lock

@@ -1,5 +1,23 @@
 {
   "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1681202837,
+        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1681272286,
@@ -18,8 +36,24 @@
     },
     "root": {
       "inputs": {
+        "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs"
       }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
     }
   },
   "root": "root",

+ 28 - 25
.config/nixpkgs/neovim/flake.nix

@@ -3,32 +3,35 @@
 
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+    flake-utils.url = "github:numtide/flake-utils";
   };
 
-  outputs = { self, nixpkgs }:
-    let
-      withPkgs = system: import nixpkgs {
-        inherit system;
-        overlays = [(final: prev: {
-          treesitter = prev.treesitter.override {
-            extraGrammars = [
-              (final.fetchFromGitHub {
-                owner = "ckafi";
-                repo = "tree-sitter-elvish";
-                rev = "f32711e31e987fd5c2c002f3daba02f25c68672f";
-                hash = "sha256-/3npcIfTH8w5ekLTb//ZCTxuSGhOXkUBaCq3WWcK2J4=";
-              })
-            ];
-          };
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let
+        pkgs = import nixpkgs {
+          inherit system;
+          overlays = [(final: prev: {
+            treesitter = prev.treesitter.override {
+              extraGrammars = [
+                (final.fetchFromGitHub {
+                  owner = "ckafi";
+                  repo = "tree-sitter-elvish";
+                  rev = "f32711e31e987fd5c2c002f3daba02f25c68672f";
+                  hash = "sha256-/3npcIfTH8w5ekLTb//ZCTxuSGhOXkUBaCq3WWcK2J4=";
+                })
+              ];
+            };
 
-          node-lsp = final.callPackage ./node-lsp {};
-        })];
-      };
-    in
-    {
-      packages.x86_64-linux.neovim = (withPkgs "x86_64-linux").callPackage ./neovim.nix {};
-      packages.x86_64-linux.neovim-with-playground = (withPkgs "x86_64-linux").callPackage ./neovim.nix { withPlayground = true; };
-      packages.x86_64-linux.neovim-with-luadev = (withPkgs "x86_64-linux").callPackage ./neovim.nix { withLuadev = true; };
-      packages.x86_64-linux.default = self.packages.x86_64-linux.neovim;
-    };
+            node-lsp = final.callPackage ./node-lsp {};
+          })];
+        };
+      in
+      {
+        packages.neovim = pkgs.callPackage ./neovim.nix {};
+        packages.neovim-with-playground = pkgs.callPackage ./neovim.nix { withPlayground = true; };
+        packages.neovim-with-luadev = pkgs.callPackage ./neovim.nix { withLuadev = true; };
+        packages.default = self.packages.${system}.neovim;
+      }
+    );
 }

+ 34 - 0
.config/nixpkgs/zsh/flake.lock

@@ -1,5 +1,23 @@
 {
   "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1681202837,
+        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1680487167,
@@ -16,8 +34,24 @@
     },
     "root": {
       "inputs": {
+        "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs"
       }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
     }
   },
   "root": "root",

+ 53 - 50
.config/nixpkgs/zsh/flake.nix

@@ -1,66 +1,69 @@
 {
   description = "Zsh configuration";
 
-  outputs = { self, nixpkgs }:
-    {
-      packages.x86_64-linux.zsh =
-        with import nixpkgs {
-          system = "x86_64-linux";
-        };
-        let
-          config = runCommand "zsh-config" {
-            nativeBuildInputs = [ makeWrapper ];
-          } ''
-            mkdir -p $out/share/zsh
+  inputs = {
+    flake-utils.url = "github:numtide/flake-utils";
+  };
 
-            cat <<EOF > $out/share/zsh/.zprofile
-            emulate sh -c 'source /etc/profile'
-            EOF
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      with nixpkgs.legacyPackages.${system}; {
+        packages.zsh =
+          let
+            config = runCommand "zsh-config" {
+              nativeBuildInputs = [ makeWrapper ];
+            } ''
+              mkdir -p $out/share/zsh
 
-            cat <<EOF > $out/share/zsh/.zshenv
-            unsetopt GLOBAL_RCS
-            EOF
+              cat <<EOF > $out/share/zsh/.zprofile
+              emulate sh -c 'source /etc/profile'
+              EOF
 
-            cat <<EOF > $out/share/zsh/.zshrc
-            source ${nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh
-            fpath+=(${nix-zsh-completions}/share/zsh/site-functions)
+              cat <<EOF > $out/share/zsh/.zshenv
+              unsetopt GLOBAL_RCS
+              EOF
 
-            fpath+=(~/.nix-profile/share/zsh/site-functions)
+              cat <<EOF > $out/share/zsh/.zshrc
+              source ${nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh
+              fpath+=(${nix-zsh-completions}/share/zsh/site-functions)
 
-            autoload -U compinit && compinit
+              fpath+=(~/.nix-profile/share/zsh/site-functions)
 
-            source ${zsh-bd}/share/zsh-bd/bd.plugin.zsh
-            source ${zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
+              autoload -U compinit && compinit
 
-            path+=(${lib.makeBinPath [ any-nix-shell ]})
+              source ${zsh-bd}/share/zsh-bd/bd.plugin.zsh
+              source ${zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
 
-            source ${./config/fzf/fzf.zsh}
-            source ${./config/config.zsh}
-            source ${./config/p10k.zsh}
-            source ${./config/title.zsh}
+              path+=(${lib.makeBinPath [ any-nix-shell ]})
 
-            if [ -f "\$HOME/.zsh/local.zsh" ]; then
-              source "\$HOME/.zsh/local.zsh"
-            fi
+              source ${./config/fzf/fzf.zsh}
+              source ${./config/config.zsh}
+              source ${./config/p10k.zsh}
+              source ${./config/title.zsh}
 
-            # must be last
-            source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
-            EOF
+              if [ -f "\$HOME/.zsh/local.zsh" ]; then
+                source "\$HOME/.zsh/local.zsh"
+              fi
+
+              # must be last
+              source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+              EOF
+            '';
+          in
+          writeScriptBin "zsh" ''
+            #!/bin/sh
+            export ZDOTDIR=${config}/share/zsh
+            for zsh in $(which -a zsh); do
+              if [ "$0" = "$zsh" ]; then
+                continue
+              fi
+              exec "$zsh" "$@"
+            done
+            echo "Could not find system zsh"
+            exit 1
           '';
-        in
-        writeScriptBin "zsh" ''
-          #!/bin/sh
-          export ZDOTDIR=${config}/share/zsh
-          for zsh in $(which -a zsh); do
-            if [ "$0" = "$zsh" ]; then
-              continue
-            fi
-            exec "$zsh" "$@"
-          done
-          echo "Could not find system zsh"
-          exit 1
-        '';
 
-      packages.x86_64-linux.default = self.packages.x86_64-linux.zsh;
-    };
+        packages.default = self.packages.${system}.zsh;
+      }
+    );
 }