mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-01-13 19:08:25 +01:00
Compare commits
2 Commits
eceb2ce4c7
...
nom
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31f2f445f3 | ||
|
|
bce1f0e912 |
11
base/nix.nix
11
base/nix.nix
@@ -1,4 +1,4 @@
|
|||||||
{ lib, config, inputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
nix = {
|
nix = {
|
||||||
gc = {
|
gc = {
|
||||||
@@ -21,16 +21,11 @@
|
|||||||
** use the same channel the system
|
** use the same channel the system
|
||||||
** was built with
|
** was built with
|
||||||
*/
|
*/
|
||||||
registry = lib.mkMerge [
|
registry = {
|
||||||
{
|
|
||||||
"nixpkgs".flake = inputs.nixpkgs;
|
"nixpkgs".flake = inputs.nixpkgs;
|
||||||
"nixpkgs-unstable".flake = inputs.nixpkgs-unstable;
|
"nixpkgs-unstable".flake = inputs.nixpkgs-unstable;
|
||||||
}
|
|
||||||
# We avoid the reference to self in vmVariant to get a stable system .outPath for equivalence testing
|
|
||||||
(lib.mkIf (!config.virtualisation.isVmVariant) {
|
|
||||||
"pvv-nix".flake = inputs.self;
|
"pvv-nix".flake = inputs.self;
|
||||||
})
|
};
|
||||||
];
|
|
||||||
nixPath = [
|
nixPath = [
|
||||||
"nixpkgs=${inputs.nixpkgs}"
|
"nixpkgs=${inputs.nixpkgs}"
|
||||||
"unstable=${inputs.nixpkgs-unstable}"
|
"unstable=${inputs.nixpkgs-unstable}"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ config, inputs, pkgs, lib, ... }:
|
{ inputs, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inputUrls = lib.mapAttrs (input: value: value.url) (import "${inputs.self}/flake.nix").inputs;
|
inputUrls = lib.mapAttrs (input: value: value.url) (import "${inputs.self}/flake.nix").inputs;
|
||||||
@@ -26,8 +26,7 @@ in
|
|||||||
|
|
||||||
# workaround for https://github.com/NixOS/nix/issues/6895
|
# workaround for https://github.com/NixOS/nix/issues/6895
|
||||||
# via https://git.lix.systems/lix-project/lix/issues/400
|
# via https://git.lix.systems/lix-project/lix/issues/400
|
||||||
environment.etc = lib.mkIf (!config.virtualisation.isVmVariant) {
|
environment.etc."current-system-flake-inputs.json".source
|
||||||
"current-system-flake-inputs.json".source
|
|
||||||
= pkgs.writers.writeJSON "flake-inputs.json" (
|
= pkgs.writers.writeJSON "flake-inputs.json" (
|
||||||
lib.flip lib.mapAttrs inputs (name: input:
|
lib.flip lib.mapAttrs inputs (name: input:
|
||||||
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like a derivation
|
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like a derivation
|
||||||
@@ -35,5 +34,4 @@ in
|
|||||||
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
|
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,9 +169,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
devShells = forAllSystems (system: {
|
devShells = forAllSystems (system: {
|
||||||
default = nixpkgs-unstable.legacyPackages.${system}.callPackage ./shell.nix { };
|
default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { };
|
||||||
cuda = let
|
cuda = let
|
||||||
cuda-pkgs = import nixpkgs-unstable {
|
cuda-pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config = {
|
config = {
|
||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
|
|||||||
4
justfile
4
justfile
@@ -1,6 +1,6 @@
|
|||||||
set positional-arguments # makes variables accesible as $1 $2 $@
|
set positional-arguments # makes variables accesible as $1 $2 $@
|
||||||
export GUM_FILTER_HEIGHT := "15"
|
export GUM_FILTER_HEIGHT := "15"
|
||||||
nom := `if [[ -t 1 ]] && command -v nom >/dev/null; then echo nom; else echo nix; fi`
|
nom := `if [[ -t 2 ]] && command -v nom >/dev/null; then echo nom; else echo nix; fi`
|
||||||
nix_eval_opts := "--log-format raw --option warn-dirty false"
|
nix_eval_opts := "--log-format raw --option warn-dirty false"
|
||||||
|
|
||||||
@_default:
|
@_default:
|
||||||
@@ -26,7 +26,7 @@ run-vm machine=`just _a_machine` *_:
|
|||||||
| xargs -d'\n' nix flake update "$@"
|
| xargs -d'\n' nix flake update "$@"
|
||||||
|
|
||||||
@repl $machine=`just _a_machine` *_:
|
@repl $machine=`just _a_machine` *_:
|
||||||
set -v; nixos-rebuild --flake .#"$machine" repl "${@:2}"
|
set -v; NIX_NO_NOM=1 nixos-rebuild --flake .#"$machine" repl "${@:2}"
|
||||||
|
|
||||||
@eval $machine=`just _a_machine` $attrpath="system.build.toplevel.outPath" *_:
|
@eval $machine=`just _a_machine` $attrpath="system.build.toplevel.outPath" *_:
|
||||||
set -v; nix eval {{nix_eval_opts}} ".#nixosConfigurations.\"$machine\".config.$attrpath" --show-trace "${@:3}"
|
set -v; nix eval {{nix_eval_opts}} ".#nixosConfigurations.\"$machine\".config.$attrpath" --show-trace "${@:3}"
|
||||||
|
|||||||
12
shell.nix
12
shell.nix
@@ -1,6 +1,18 @@
|
|||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let
|
||||||
|
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
|
||||||
|
if [[ -t 1 && -z "''${NIX_NO_NOM-}" ]]; then
|
||||||
|
exec ${pkgs.lib.getExe pkgs.nixos-rebuild} -L "$@" |& ${pkgs.lib.getExe pkgs.nix-output-monitor}
|
||||||
|
else
|
||||||
|
exec ${pkgs.lib.getExe pkgs.nixos-rebuild} -L "$@"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
pkgs.mkShellNoCC {
|
pkgs.mkShellNoCC {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
nixos-rebuild-nom
|
||||||
just
|
just
|
||||||
jq
|
jq
|
||||||
gum
|
gum
|
||||||
|
|||||||
Reference in New Issue
Block a user