mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2025-12-26 16:24:56 +08:00
initial commit
This commit is contained in:
parent
bd70f8eb74
commit
374030a540
3 changed files with 94 additions and 0 deletions
24
source/new-flake/bash-flake/flake-3.nix
Normal file
24
source/new-flake/bash-flake/flake-3.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
description = "what does the cow say";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
|
||||
devShells =
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
${system}.default =
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.cowsay
|
||||
];
|
||||
}; # mkShell
|
||||
}; # devShells
|
||||
|
||||
};
|
||||
}
|
||||
50
source/new-flake/bash-flake/flake-4.nix
Normal file
50
source/new-flake/bash-flake/flake-4.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
description = "what does the cow say";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
|
||||
devShells =
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
${system}.default =
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.cowsay
|
||||
];
|
||||
}; # mkShell
|
||||
}; # devShells
|
||||
|
||||
packages =
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in rec {
|
||||
${system}.hello = pkgs.stdenv.mkDerivation {
|
||||
name = "cow-hello";
|
||||
|
||||
src = ./.;
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
buildPhase = ":";
|
||||
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp $src/cow-hello.sh $out/bin
|
||||
chmod +x $out/bin/cow-hello.sh
|
||||
'';
|
||||
|
||||
buildInputs = [ pkgs.cowsay ];
|
||||
};
|
||||
${system}.default = hello;
|
||||
|
||||
}; # packages
|
||||
};
|
||||
}
|
||||
20
source/new-flake/bash-flake/flake.nix
Normal file
20
source/new-flake/bash-flake/flake.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
description = "what does the cow say";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
|
||||
devShells = {
|
||||
x86_64-linux.default =
|
||||
nixpkgs.legacyPackages.x86_64-linux.mkShell {
|
||||
packages = [
|
||||
nixpkgs.legacyPackages.x86_64-linux.cowsay
|
||||
];
|
||||
}; # mkShell
|
||||
}; # devShells
|
||||
|
||||
}; # outputs
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue