mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2025-12-27 08:44:56 +08:00
temp
This commit is contained in:
parent
e4e136a823
commit
ffb97b96ff
9 changed files with 965 additions and 1206 deletions
2054
index.html
2054
index.html
File diff suppressed because it is too large
Load diff
|
|
@ -5,3 +5,6 @@ include::nixpkg/main-generated.adoc[leveloffset=+1]
|
|||
include::flake/main-generated.adoc[leveloffset=+1]
|
||||
|
||||
include::haskell-pkg/main-generated.adoc[leveloffset=+1]
|
||||
|
||||
include::non-flake/main-generated.adoc[leveloffset=+1]
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,29 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hello-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1676213208,
|
||||
"narHash": "sha256-Zds5C+f5sA3w+j85EsAQjte0zeHqubMVPGYn5lGwATo=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "aa2c87f8b89578b069b09fdb2be30a0c9d8a77d8",
|
||||
"revCount": 4,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/mhwombat/hello-nix"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/mhwombat/hello-nix"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1757012778,
|
||||
"narHash": "sha256-TfvMA0TsVj754lmK0VRj3OaoK4k5djo7UWsJDDGYvj0=",
|
||||
"lastModified": 1757096966,
|
||||
"narHash": "sha256-nJpPWCFbc5/u0VIoSHT350FEwPS5pwiRfyZBbZA3Kgg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a7a241d389c733eec41ce783696ced2fdf21a3cf",
|
||||
"rev": "6eb784fb955ab56952e6eeb01f3e64a79933e2b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -36,6 +52,7 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"hello-nix": "hello-nix",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
|
|
@ -2,18 +2,24 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
hello-nix = {
|
||||
url = "git+https://codeberg.org/mhwombat/hello-nix";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
outputs = { self, nixpkgs, flake-utils, hello-nix }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
customGhc = pkgs.haskellPackages.ghcWithPackages (p: with p; [ containers ]);
|
||||
in
|
||||
{
|
||||
devShells = rec {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [ customGhc ];
|
||||
shellHook =
|
||||
''
|
||||
PATH=${hello-nix}:$PATH
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
with (import <nixpkgs> {});
|
||||
let
|
||||
customGhc = haskellPackages.ghcWithPackages (pkgs: with pkgs; [ containers ]);
|
||||
in
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
customGhc
|
||||
];
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
# See https://github.com/mhwombat/nix-for-numbskulls/blob/main/flakes.md
|
||||
# for a brief overview of what each section in a flake should or can contain.
|
||||
|
||||
description = "a sample flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
hello-nix = {
|
||||
url = "git+https://codeberg.org/mhwombat/hello-nix";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, hello-nix }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
devShells = rec {
|
||||
default = pkgs.mkShell {
|
||||
packages = [ hello-nix ];
|
||||
};
|
||||
};
|
||||
|
||||
packages = rec {
|
||||
hello = pkgs.stdenv.mkDerivation rec {
|
||||
name = "hello-again";
|
||||
|
||||
src = ./.;
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
buildPhase = ":";
|
||||
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp $src/hello-again $out/bin/hello-again
|
||||
chmod +x $out/bin/hello-again
|
||||
'';
|
||||
};
|
||||
default = hello;
|
||||
};
|
||||
|
||||
apps = rec {
|
||||
hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
|
||||
default = hello;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
echo "I'm a flake, but I'm running a command defined in a non-flake package."
|
||||
hello-nix
|
||||
|
|
@ -5,4 +5,12 @@ which is defined in a remote git repo on codeberg.
|
|||
To use a package from GitHub, GitLab, or any other public platform,
|
||||
modify the URL.
|
||||
|
||||
include::shell/main-generated.adoc[leveloffset=+1]
|
||||
REMOVE ME
|
||||
|
||||
REMOVE ME
|
||||
|
||||
REMOVE ME
|
||||
|
||||
REMOVE ME
|
||||
|
||||
include::flake/main-generated.adoc[leveloffset=+1]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ $ nix run ~/codeberg/hello-flake
|
|||
$ nix run git+https://codeberg.org/mhwombat/hello-flake
|
||||
....
|
||||
|
||||
To use a package from GitHub, GitLab, or any other public platform,
|
||||
modify the URL accordingly.
|
||||
To run a specific branch, use the command below.
|
||||
|
||||
....
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue