1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-23 08:02:21 +03:00
This commit is contained in:
nrdxp 2021-03-15 03:37:13 +00:00
parent f8bf4403a6
commit dcbf462c3b
15 changed files with 145 additions and 69 deletions

View File

@ -165,15 +165,20 @@
<main>
<h1 id="update"><a class="header" href="#update">update</a></h1>
<p>The <code>update</code> subcommand is a simple alias for:</p>
<pre><code class="language-sh">nix flake update --recreate-lock-file --commit-lock-file
<pre><code class="language-sh">nix flake update
</code></pre>
<p>As it sounds, this will update your lock file, and commit it.</p>
<p>As it sounds, this will update your lock file.</p>
<h2 id="updating-package-sources"><a class="header" href="#updating-package-sources">Updating Package Sources</a></h2>
<p>If you pass an input name then it will only update that input.</p>
<p>If you pass directory name then it will update that input if the directory
contains a flake.nix, with an optional arguement to update only a specific
input in the subflake.</p>
<p>For example, you can update any
<a href="../../pkgs#automatic-source-updates">package sources</a> you may have declared
in <em>pkgs/flake.nix</em>:</p>
<pre><code class="language-sh">flk update srcs
<pre><code class="language-sh">flk update pkgs
</code></pre>
<p>or just its <em>nixpkgs</em>:</p>
<pre><code class="language-sh">flk update pkgs nixpkgs
</code></pre>
</main>

2
extern/default.nix vendored
View File

@ -9,11 +9,13 @@ in
];
overlays = [
nix.overlay
nur.overlay
devshell.overlay
(final: prev: {
deploy-rs = deploy.packages.${prev.system}.deploy-rs;
})
pkgs.overlay
];
# passed to all nixos modules

View File

@ -152,6 +152,25 @@
"type": "github"
}
},
"nix": {
"inputs": {
"nixpkgs": [
"nixos"
]
},
"locked": {
"lastModified": 1615476733,
"narHash": "sha256-iae4JMAl2KAaPhUGLMf4/DEejWjs5fWfEU1ccVF8s6Q=",
"owner": "NixOS",
"repo": "nix",
"rev": "8127094f767b6caae145bc395a504ca62f30af3e",
"type": "github"
},
"original": {
"id": "nix",
"type": "indirect"
}
},
"nixos": {
"locked": {
"lastModified": 1614531331,
@ -210,6 +229,22 @@
"type": "indirect"
}
},
"pkgs": {
"inputs": {
"nixpkgs": [
"nixos"
]
},
"locked": {
"narHash": "sha256-sBVaeGxxs7sk7PodW1mqJbF0CqUqUar0GUdd+OPnZ8o=",
"path": "./pkgs",
"type": "path"
},
"original": {
"path": "./pkgs",
"type": "path"
}
},
"pre-commit-hooks-nix": {
"flake": false,
"locked": {
@ -235,25 +270,15 @@
"flake-compat": "flake-compat",
"home": "home",
"naersk": "naersk",
"nix": "nix",
"nixos": "nixos",
"nixos-hardware": "nixos-hardware",
"nur": "nur",
"override": "override",
"srcs": "srcs",
"pkgs": "pkgs",
"utils": "utils"
}
},
"srcs": {
"locked": {
"narHash": "sha256-Ot96/oKT5+A5kdqkfYyT45cfEiqhI5UyPdEfEZjbXaA=",
"path": "./pkgs",
"type": "path"
},
"original": {
"path": "./pkgs",
"type": "path"
}
},
"utils": {
"locked": {
"lastModified": 1608663846,

View File

@ -22,12 +22,14 @@
home.inputs.nixpkgs.follows = "nixos";
naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "override";
nix.inputs.nixpkgs.follows = "nixos";
nixos-hardware.url = "github:nixos/nixos-hardware";
utils.url = "github:numtide/flake-utils/flatten-tree-system";
srcs.url = "path:./pkgs";
pkgs.url = "path:./pkgs";
pkgs.inputs.nixpkgs.follows = "nixos";
};
outputs = inputs@{ deploy, nixos, nur, self, utils, ... }:
outputs = inputs@{ deploy, nixos, nur, nix, self, utils, ... }:
let
inherit (self) lib;
inherit (lib) os;

View File

@ -14,42 +14,6 @@ in
(overridesOverlay overridePkgs)
self.overlay
(final: prev: {
srcs =
let
mkVersion = name: input:
let
inputs = (builtins.fromJSON
(builtins.readFile ../../flake.lock)).nodes;
ref =
if lib.hasAttrByPath [ name "original" "ref" ] inputs
then inputs.${name}.original.ref
else "";
version =
let version' = builtins.match
"[[:alpha:]]*[-._]?([0-9]+(\.[0-9]+)*)+"
ref;
in
if lib.isList version'
then lib.head version'
else if input ? lastModifiedDate && input ? shortRev
then "${lib.substring 0 8 input.lastModifiedDate}_${input.shortRev}"
else null;
in
version;
in
lib.mapAttrs
(name: input:
let
version = mkVersion name input;
in
input // lib.optionalAttrs (! isNull version)
{
inherit version;
}
)
self.inputs.srcs.inputs;
lib = prev.lib.extend (lfinal: lprev: {
inherit dev;
inherit (lib) nixosSystem;

View File

@ -1,5 +1,5 @@
final: prev: {
nixFlakes = prev.nixFlakes.overrideAttrs
nixFlakes = final.nix.overrideAttrs
(self:
let
oldPatches = self.patches or [ ];

View File

@ -9,12 +9,12 @@
# packages pulled from override
packages = pkgs: final: prev: {
inherit (pkgs)
cachix
dhall
discord
element-desktop
manix
nixpkgs-fmt
nixFlakes
qutebrowser
signal-desktop
starship;

25
pkgs/flake.lock Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1615769536,
"narHash": "sha256-oah5pb8kXyFa6ZcccvfREuY9VXHkUTNaoClXW7H1XUw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63a9f162355ec84c423690869a97848d73409fb8",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,7 +1,52 @@
{
description = "Package sources";
description = "Package Sources";
inputs = { };
outputs = { ... }: { };
outputs = { self, nixpkgs, ... }: {
overlay = final: prev: {
inherit (self) srcs;
};
srcs =
let
inherit (nixpkgs) lib;
mkVersion = name: input:
let
inputs = (builtins.fromJSON
(builtins.readFile ./flake.lock)).nodes;
ref =
if lib.hasAttrByPath [ name "original" "ref" ] inputs
then inputs.${name}.original.ref
else "";
version =
let version' = builtins.match
"[[:alpha:]]*[-._]?([0-9]+(\.[0-9]+)*)+"
ref;
in
if lib.isList version'
then lib.head version'
else if input ? lastModifiedDate && input ? shortRev
then "${lib.substring 0 8 input.lastModifiedDate}_${input.shortRev}"
else null;
in
version;
in
lib.mapAttrs
(pname: input:
let
version = mkVersion pname input;
in
input // { inherit pname; }
// lib.optionalAttrs (! isNull version)
{
inherit version;
}
)
(lib.filterAttrs (n: _: n != "nixpkgs")
self.inputs);
};
}

View File

@ -817,15 +817,20 @@ compatible with devos. There is a short explanation in the the getting started
<a href="doc/flk/../start/from-nixos.html#generate-configuration">guide</a>.</p>
<h1 id="update"><a class="header" href="#update">update</a></h1>
<p>The <code>update</code> subcommand is a simple alias for:</p>
<pre><code class="language-sh">nix flake update --recreate-lock-file --commit-lock-file
<pre><code class="language-sh">nix flake update
</code></pre>
<p>As it sounds, this will update your lock file, and commit it.</p>
<p>As it sounds, this will update your lock file.</p>
<h2 id="updating-package-sources"><a class="header" href="#updating-package-sources">Updating Package Sources</a></h2>
<p>If you pass an input name then it will only update that input.</p>
<p>If you pass directory name then it will update that input if the directory
contains a flake.nix, with an optional arguement to update only a specific
input in the subflake.</p>
<p>For example, you can update any
<a href="doc/flk/../../pkgs#automatic-source-updates">package sources</a> you may have declared
in <em>pkgs/flake.nix</em>:</p>
<pre><code class="language-sh">flk update srcs
<pre><code class="language-sh">flk update pkgs
</code></pre>
<p>or just its <em>nixpkgs</em>:</p>
<pre><code class="language-sh">flk update pkgs nixpkgs
</code></pre>
<h1 id="get"><a class="header" href="#get">get</a></h1>
<p>The <code>get</code> subcommand is useful for getting a bare copy of devos without the

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,7 @@ pkgs.devshell.mkShell
nixos-install
nixos-generate-config
nixos-enter
pkgs.nixFlakes
];
git.hooks = {

View File

@ -25,8 +25,5 @@ category = "documentation"
package = "mdbook"
category = "documentation"
[[commands]]
package = "nixFlakes"
[git.hooks]
enable = true

View File

@ -50,9 +50,14 @@ case "$1" in
"update")
if [[ -n "$2" ]]; then
nix flake update --update-input "$2" --commit-lock-file "$DEVSHELL_ROOT"
if [[ -n "$3" ]]; then
(cd $2; nix flake list-inputs --update-input "$3")
else
(cd $2; nix flake update)
fi
nix flake list-inputs --update-input "$2" "$DEVSHELL_ROOT"
else
nix flake update --recreate-lock-file --commit-lock-file "$DEVSHELL_ROOT"
nix flake update "$DEVSHELL_ROOT"
fi
;;