Fix a few issues
This commit is contained in:
parent
7d9af4a648
commit
2c2af9ecda
27
01-devshell/flake.lock
generated
Normal file
27
01-devshell/flake.lock
generated
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1776169885,
|
||||||
|
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@ -10,11 +10,13 @@
|
|||||||
|
|
||||||
# Outputs: a function that receives all inputs and returns an attrset.
|
# Outputs: a function that receives all inputs and returns an attrset.
|
||||||
# The attrset's structure is what `nix` CLI commands look for (e.g. `devShells.<system>.default`).
|
# The attrset's structure is what `nix` CLI commands look for (e.g. `devShells.<system>.default`).
|
||||||
outputs = { self, nixpkgs, ... }:
|
outputs =
|
||||||
|
{ nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# `nix develop` picks this up by default.
|
# `nix develop` picks this up by default.
|
||||||
devShells.${system}.default = pkgs.mkShell {
|
devShells.${system}.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
|||||||
@ -8,11 +8,13 @@
|
|||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }:
|
outputs =
|
||||||
|
{ self, nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
packages.${system}.default = pkgs.stdenv.mkDerivation {
|
packages.${system}.default = pkgs.stdenv.mkDerivation {
|
||||||
pname = "greet";
|
pname = "greet";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
@ -42,6 +44,7 @@
|
|||||||
apps.${system}.default = {
|
apps.${system}.default = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = "${self.packages.${system}.default}/bin/greet";
|
program = "${self.packages.${system}.default}/bin/greet";
|
||||||
|
meta.description = "Run the packaged greet script.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }:
|
outputs =
|
||||||
|
{ self, nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
# List every system you want to support.
|
# List every system you want to support.
|
||||||
supportedSystems = [
|
supportedSystems = [
|
||||||
@ -20,11 +21,10 @@
|
|||||||
|
|
||||||
# Helper: apply a function to each system and collect results into an attrset.
|
# Helper: apply a function to each system and collect results into an attrset.
|
||||||
# `nixpkgs.lib.genAttrs` turns a list of keys + a function into { key = f key; … }.
|
# `nixpkgs.lib.genAttrs` turns a list of keys + a function into { key = f key; … }.
|
||||||
forAllSystems = f:
|
forAllSystems =
|
||||||
nixpkgs.lib.genAttrs supportedSystems (system:
|
f: nixpkgs.lib.genAttrs supportedSystems (system: f (import nixpkgs { inherit system; }));
|
||||||
f (import nixpkgs { inherit system; })
|
in
|
||||||
);
|
{
|
||||||
in {
|
|
||||||
# Every output that varies per system goes through `forAllSystems`.
|
# Every output that varies per system goes through `forAllSystems`.
|
||||||
packages = forAllSystems (pkgs: {
|
packages = forAllSystems (pkgs: {
|
||||||
default = pkgs.writeShellScriptBin "hello-multi" ''
|
default = pkgs.writeShellScriptBin "hello-multi" ''
|
||||||
@ -34,7 +34,10 @@
|
|||||||
|
|
||||||
devShells = forAllSystems (pkgs: {
|
devShells = forAllSystems (pkgs: {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
packages = with pkgs; [ jq ripgrep ];
|
packages = with pkgs; [
|
||||||
|
jq
|
||||||
|
ripgrep
|
||||||
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
echo "dev shell on $(uname -s)/$(uname -m)"
|
echo "dev shell on $(uname -s)/$(uname -m)"
|
||||||
'';
|
'';
|
||||||
@ -44,8 +47,8 @@
|
|||||||
# `nix flake check` evaluates everything under `checks`.
|
# `nix flake check` evaluates everything under `checks`.
|
||||||
# Wrapping a simple test here shows the pattern.
|
# Wrapping a simple test here shows the pattern.
|
||||||
checks = forAllSystems (pkgs: {
|
checks = forAllSystems (pkgs: {
|
||||||
runs = pkgs.runCommand "hello-multi-runs" {} ''
|
runs = pkgs.runCommand "hello-multi-runs" { } ''
|
||||||
${self.packages.${pkgs.system}.default}/bin/hello-multi > $out
|
${self.packages.${pkgs.stdenv.hostPlatform.system}.default}/bin/hello-multi > $out
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
6
Makefile
6
Makefile
@ -5,9 +5,9 @@ EXAMPLES := $(sort $(wildcard [0-9][0-9]-*))
|
|||||||
# Tools are invoked via `nix run` so nothing needs to be pre-installed beyond Nix itself.
|
# Tools are invoked via `nix run` so nothing needs to be pre-installed beyond Nix itself.
|
||||||
# Override any of these if you have the tools on $PATH and want faster startup.
|
# Override any of these if you have the tools on $PATH and want faster startup.
|
||||||
NIX ?= nix
|
NIX ?= nix
|
||||||
NIXFMT ?= $(NIX) run nixpkgs#nixfmt-rfc-style --
|
NIXFMT ?= $(NIX) run nixpkgs\#nixfmt --
|
||||||
STATIX ?= $(NIX) run nixpkgs#statix --
|
STATIX ?= $(NIX) run nixpkgs\#statix --
|
||||||
DEADNIX ?= $(NIX) run nixpkgs#deadnix --
|
DEADNIX ?= $(NIX) run nixpkgs\#deadnix --
|
||||||
|
|
||||||
# Selector for single-example targets (dev, show, update-one).
|
# Selector for single-example targets (dev, show, update-one).
|
||||||
EXAMPLE ?=
|
EXAMPLE ?=
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user