format with nixpkgs-fmt
This commit is contained in:
parent
2ca351fdac
commit
be65264a3f
20 changed files with 203 additions and 213 deletions
|
@ -1,7 +1,5 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
postBuildHook = pkgs.writeScript "post-build-hook.sh" ''
|
postBuildHook = pkgs.writeScript "post-build-hook.sh" ''
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
export PATH=$PATH:${pkgs.nix}/bin
|
export PATH=$PATH:${pkgs.nix}/bin
|
||||||
|
@ -16,7 +14,8 @@ let
|
||||||
|
|
||||||
sources = import ../nix/sources.nix;
|
sources = import ../nix/sources.nix;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(self: super: {
|
(self: super: {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userImports =
|
userImports =
|
||||||
let
|
let
|
||||||
|
@ -7,7 +6,7 @@ let
|
||||||
onlyUserFiles = x:
|
onlyUserFiles = x:
|
||||||
lib.hasSuffix ".nix" x &&
|
lib.hasSuffix ".nix" x &&
|
||||||
x != "lib.nix"
|
x != "lib.nix"
|
||||||
;
|
;
|
||||||
userDirEntries = builtins.readDir ../users;
|
userDirEntries = builtins.readDir ../users;
|
||||||
userFiles = builtins.filter onlyUserFiles (lib.attrNames userDirEntries);
|
userFiles = builtins.filter onlyUserFiles (lib.attrNames userDirEntries);
|
||||||
in
|
in
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
gitlabModule = builtins.fetchTarball {
|
gitlabModule = builtins.fetchTarball {
|
||||||
url = "https://gitlab.com/arianvp/nixos-gitlab-runner/-/archive/9126927c701aa399bd1734e7e5230c3a0010c1b7/nixos-gitlab-runner-9126927c701aa399bd1734e7e5230c3a0010c1b7.tar.gz";
|
url = "https://gitlab.com/arianvp/nixos-gitlab-runner/-/archive/9126927c701aa399bd1734e7e5230c3a0010c1b7/nixos-gitlab-runner-9126927c701aa399bd1734e7e5230c3a0010c1b7.tar.gz";
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" ];
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [];
|
swapDevices = [ ];
|
||||||
|
|
||||||
nix.maxJobs = lib.mkDefault 16;
|
nix.maxJobs = lib.mkDefault 16;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config;
|
cfg = config;
|
||||||
|
|
||||||
|
@ -17,10 +16,11 @@ let
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
wrapProgram "$out/bin/create-declarative-project" \
|
wrapProgram "$out/bin/create-declarative-project" \
|
||||||
--prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]}
|
--prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.services.hydra = {
|
options.services.hydra = {
|
||||||
adminPasswordFile = mkOption {
|
adminPasswordFile = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -29,7 +29,7 @@ in {
|
||||||
|
|
||||||
declarativeProjects = mkOption {
|
declarativeProjects = mkOption {
|
||||||
description = "Declarative projects";
|
description = "Declarative projects";
|
||||||
default = {};
|
default = { };
|
||||||
type = with types; attrsOf (submodule {
|
type = with types; attrsOf (submodule {
|
||||||
options = {
|
options = {
|
||||||
inputValue = mkOption {
|
inputValue = mkOption {
|
||||||
|
@ -82,7 +82,7 @@ in {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:${toString(hydraPort)}";
|
proxyPass = "http://localhost:${toString (hydraPort)}";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -119,12 +119,13 @@ in {
|
||||||
allowed-uris = https://github.com/nix-community/ https://github.com/NixOS/
|
allowed-uris = https://github.com/nix-community/ https://github.com/NixOS/
|
||||||
'';
|
'';
|
||||||
buildMachines = [
|
buildMachines = [
|
||||||
{
|
{
|
||||||
hostName = "localhost";
|
hostName = "localhost";
|
||||||
systems = [ "x86_64-linux" "builtin" ];
|
systems = [ "x86_64-linux" "builtin" ];
|
||||||
maxJobs = 8;
|
maxJobs = 8;
|
||||||
supportedFeatures = [ "nixos-test" "big-parallel" "kvm" ];
|
supportedFeatures = [ "nixos-test" "big-parallel" "kvm" ];
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create a admin user and configure a declarative project
|
# Create a admin user and configure a declarative project
|
||||||
|
@ -134,7 +135,7 @@ in {
|
||||||
TimeoutStartSec = "60";
|
TimeoutStartSec = "60";
|
||||||
};
|
};
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = ["hydra-server.service" ];
|
after = [ "hydra-server.service" ];
|
||||||
requires = [ "hydra-server.service" ];
|
requires = [ "hydra-server.service" ];
|
||||||
environment = {
|
environment = {
|
||||||
inherit (cfg.systemd.services.hydra-init.environment) HYDRA_DBI;
|
inherit (cfg.systemd.services.hydra-init.environment) HYDRA_DBI;
|
||||||
|
@ -151,17 +152,18 @@ in {
|
||||||
|
|
||||||
export URL=http://localhost:${toString hydraPort}
|
export URL=http://localhost:${toString hydraPort}
|
||||||
'' +
|
'' +
|
||||||
(concatStringsSep "\n" (mapAttrsToList (n: v: ''
|
(concatStringsSep "\n" (mapAttrsToList
|
||||||
export DECL_PROJECT_NAME="${n}"
|
(n: v: ''
|
||||||
export DECL_DISPLAY_NAME="${v.displayName}"
|
export DECL_PROJECT_NAME="${n}"
|
||||||
export DECL_VALUE="${v.inputValue}"
|
export DECL_DISPLAY_NAME="${v.displayName}"
|
||||||
export DECL_TYPE="${v.inputType}"
|
export DECL_VALUE="${v.inputValue}"
|
||||||
export DECL_FILE="${v.specFile}"
|
export DECL_TYPE="${v.inputType}"
|
||||||
export DECL_DESCRIPTION="${v.description}"
|
export DECL_FILE="${v.specFile}"
|
||||||
export DECL_HOMEPAGE="${v.homepage}"
|
export DECL_DESCRIPTION="${v.description}"
|
||||||
${createDeclarativeProjectScript}/bin/create-declarative-project
|
export DECL_HOMEPAGE="${v.homepage}"
|
||||||
'') cfg.services.hydra.declarativeProjects));
|
${createDeclarativeProjectScript}/bin/create-declarative-project
|
||||||
|
'')
|
||||||
|
cfg.services.hydra.declarativeProjects));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ let
|
||||||
userLib = import ../users/lib.nix { inherit lib; };
|
userLib = import ../users/lib.nix { inherit lib; };
|
||||||
sources = import ../nix/sources.nix;
|
sources = import ../nix/sources.nix;
|
||||||
|
|
||||||
marvinNixpkgs = (import (sources.marvin-mk2.outPath + "/definitions.nix") {}).pkgs;
|
marvinNixpkgs = (import (sources.marvin-mk2.outPath + "/definitions.nix") { }).pkgs;
|
||||||
|
|
||||||
marvin-mk2 = marvinNixpkgs.python3.pkgs.buildPythonApplication rec {
|
marvin-mk2 = marvinNixpkgs.python3.pkgs.buildPythonApplication rec {
|
||||||
pname = "marvin-mk2";
|
pname = "marvin-mk2";
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
services.matterbridge.enable = true;
|
services.matterbridge.enable = true;
|
||||||
services.matterbridge.configPath = "/run/keys/matterbridge.toml";
|
services.matterbridge.configPath = "/run/keys/matterbridge.toml";
|
||||||
# Allow to access /run/keys
|
# Allow to access /run/keys
|
||||||
users.users.matterbridge.extraGroups = ["keys"];
|
users.users.matterbridge.extraGroups = [ "keys" ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ../users/lib.nix { inherit lib; };
|
userLib = import ../users/lib.nix { inherit lib; };
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ let
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
users.groups.r-ryantm = {};
|
users.groups.r-ryantm = { };
|
||||||
users.users.r-ryantm = {
|
users.users.r-ryantm = {
|
||||||
useDefaultShell = true;
|
useDefaultShell = true;
|
||||||
isNormalUser = true; # The hub cli seems to really want stuff to be set up like a normal user
|
isNormalUser = true; # The hub cli seems to really want stuff to be set up like a normal user
|
||||||
|
@ -42,7 +41,7 @@ in
|
||||||
# Used by nixpkgs-update-pypi-releases
|
# Used by nixpkgs-update-pypi-releases
|
||||||
environment.NIX_PATH = "nixpkgs=/var/cache/nixpkgs-update/nixpkgs";
|
environment.NIX_PATH = "nixpkgs=/var/cache/nixpkgs-update/nixpkgs";
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "r-ryantm";
|
User = "r-ryantm";
|
||||||
Group = "r-ryantm";
|
Group = "r-ryantm";
|
||||||
|
|
223
deployment.nix
223
deployment.nix
|
@ -1,5 +1,4 @@
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
let
|
let
|
||||||
secrets = import ./secrets.nix;
|
secrets = import ./secrets.nix;
|
||||||
|
|
||||||
|
@ -23,119 +22,119 @@ in
|
||||||
|
|
||||||
build01 =
|
build01 =
|
||||||
{ resources, ... }:
|
{ resources, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./build01/configuration.nix
|
./build01/configuration.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
deployment.targetHost = "94.130.143.84";
|
deployment.targetHost = "94.130.143.84";
|
||||||
|
|
||||||
deployment.keys.buildkite-token = {
|
|
||||||
text = removeSuffix "\n" secrets.buildkite-token;
|
|
||||||
user = "buildkite-agent-ci";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys.buildkite-agent-key = {
|
|
||||||
text = secrets.buildkite-agent-key;
|
|
||||||
user = "buildkite-agent-ci";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."buildkite-agent-key.pub" = {
|
|
||||||
text = secrets."buildkite-agent-key.pub";
|
|
||||||
user = "buildkite-agent-ci";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys.gitlab-runner-registration = {
|
|
||||||
text = secrets.gitlab-runner-registration;
|
|
||||||
user = "gitlab-runner";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."id_rsa" = {
|
|
||||||
text = secrets.github-r-ryantm-key;
|
|
||||||
destDir = "/home/r-ryantm/.ssh";
|
|
||||||
user = "r-ryantm";
|
|
||||||
group = "r-ryantm";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."github_token.txt" = {
|
|
||||||
text = secrets.github-r-ryantm-token;
|
|
||||||
destDir = "/var/lib/nixpkgs-update";
|
|
||||||
user = "r-ryantm";
|
|
||||||
group = "r-ryantm";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."github_token_with_username.txt" = {
|
|
||||||
text = "r-ryantm:${secrets.github-r-ryantm-token}";
|
|
||||||
destDir = "/var/lib/nixpkgs-update";
|
|
||||||
user = "r-ryantm";
|
|
||||||
group = "r-ryantm";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."marvin-mk2-key.pem" = {
|
|
||||||
text = secrets."marvin-mk2-key.pem";
|
|
||||||
destDir = "/var/lib/marvin-mk2";
|
|
||||||
user = "marvin-mk2";
|
|
||||||
group = "marvin-mk2";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."marvin_mk2_id.txt" = {
|
|
||||||
text = secrets."marvin_mk2_id.txt";
|
|
||||||
destDir = "/var/lib/marvin-mk2";
|
|
||||||
user = "marvin-mk2";
|
|
||||||
group = "marvin-mk2";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."marvin-mk2-webhook-secret.txt" = {
|
|
||||||
text = secrets."marvin-mk2-webhook-secret.txt";
|
|
||||||
destDir = "/var/lib/marvin-mk2";
|
|
||||||
user = "marvin-mk2";
|
|
||||||
group = "marvin-mk2";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."matterbridge.toml" = {
|
|
||||||
text = secrets."matterbridge.toml";
|
|
||||||
user = "matterbridge";
|
|
||||||
group = "matterbridge";
|
|
||||||
permissions = "0400";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."cachix.dhall" = {
|
|
||||||
text = secrets."cachix.dhall";
|
|
||||||
destDir = "/var/lib/nixpkgs-update/cachix";
|
|
||||||
user = "r-ryantm";
|
|
||||||
group = "r-ryantm";
|
|
||||||
permissions = "0600";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys."nix-community-cachix.dhall" = {
|
|
||||||
text = secrets."nix-community-cachix.dhall";
|
|
||||||
destDir = "/var/lib/post-build-hook";
|
|
||||||
user = "root";
|
|
||||||
permissions = "0400";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys.github-nixpkgs-swh-key = {
|
|
||||||
text = secrets.github-nixpkgs-swh-key;
|
|
||||||
user = "buildkite-agent-ci";
|
|
||||||
permissions = "0400";
|
|
||||||
};
|
|
||||||
|
|
||||||
deployment.keys.hydra-admin-password = {
|
|
||||||
text = secrets.hydra-admin-password;
|
|
||||||
user = "hydra";
|
|
||||||
permissions = "0400";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
deployment.keys.buildkite-token = {
|
||||||
|
text = removeSuffix "\n" secrets.buildkite-token;
|
||||||
|
user = "buildkite-agent-ci";
|
||||||
|
permissions = "0600";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
deployment.keys.buildkite-agent-key = {
|
||||||
|
text = secrets.buildkite-agent-key;
|
||||||
|
user = "buildkite-agent-ci";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."buildkite-agent-key.pub" = {
|
||||||
|
text = secrets."buildkite-agent-key.pub";
|
||||||
|
user = "buildkite-agent-ci";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys.gitlab-runner-registration = {
|
||||||
|
text = secrets.gitlab-runner-registration;
|
||||||
|
user = "gitlab-runner";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."id_rsa" = {
|
||||||
|
text = secrets.github-r-ryantm-key;
|
||||||
|
destDir = "/home/r-ryantm/.ssh";
|
||||||
|
user = "r-ryantm";
|
||||||
|
group = "r-ryantm";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."github_token.txt" = {
|
||||||
|
text = secrets.github-r-ryantm-token;
|
||||||
|
destDir = "/var/lib/nixpkgs-update";
|
||||||
|
user = "r-ryantm";
|
||||||
|
group = "r-ryantm";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."github_token_with_username.txt" = {
|
||||||
|
text = "r-ryantm:${secrets.github-r-ryantm-token}";
|
||||||
|
destDir = "/var/lib/nixpkgs-update";
|
||||||
|
user = "r-ryantm";
|
||||||
|
group = "r-ryantm";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."marvin-mk2-key.pem" = {
|
||||||
|
text = secrets."marvin-mk2-key.pem";
|
||||||
|
destDir = "/var/lib/marvin-mk2";
|
||||||
|
user = "marvin-mk2";
|
||||||
|
group = "marvin-mk2";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."marvin_mk2_id.txt" = {
|
||||||
|
text = secrets."marvin_mk2_id.txt";
|
||||||
|
destDir = "/var/lib/marvin-mk2";
|
||||||
|
user = "marvin-mk2";
|
||||||
|
group = "marvin-mk2";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."marvin-mk2-webhook-secret.txt" = {
|
||||||
|
text = secrets."marvin-mk2-webhook-secret.txt";
|
||||||
|
destDir = "/var/lib/marvin-mk2";
|
||||||
|
user = "marvin-mk2";
|
||||||
|
group = "marvin-mk2";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."matterbridge.toml" = {
|
||||||
|
text = secrets."matterbridge.toml";
|
||||||
|
user = "matterbridge";
|
||||||
|
group = "matterbridge";
|
||||||
|
permissions = "0400";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."cachix.dhall" = {
|
||||||
|
text = secrets."cachix.dhall";
|
||||||
|
destDir = "/var/lib/nixpkgs-update/cachix";
|
||||||
|
user = "r-ryantm";
|
||||||
|
group = "r-ryantm";
|
||||||
|
permissions = "0600";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys."nix-community-cachix.dhall" = {
|
||||||
|
text = secrets."nix-community-cachix.dhall";
|
||||||
|
destDir = "/var/lib/post-build-hook";
|
||||||
|
user = "root";
|
||||||
|
permissions = "0400";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys.github-nixpkgs-swh-key = {
|
||||||
|
text = secrets.github-nixpkgs-swh-key;
|
||||||
|
user = "buildkite-agent-ci";
|
||||||
|
permissions = "0400";
|
||||||
|
};
|
||||||
|
|
||||||
|
deployment.keys.hydra-admin-password = {
|
||||||
|
text = secrets.hydra-admin-password;
|
||||||
|
user = "hydra";
|
||||||
|
permissions = "0400";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ let
|
||||||
|
|
||||||
pkgs = import sources.nixpkgs {
|
pkgs = import sources.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config = {};
|
config = { };
|
||||||
overlays = import ./overlays.nix;
|
overlays = import ./overlays.nix;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
pkgs
|
pkgs
|
||||||
|
|
|
@ -7,7 +7,7 @@ let
|
||||||
;
|
;
|
||||||
|
|
||||||
terraform-provider-vpsadmin =
|
terraform-provider-vpsadmin =
|
||||||
pkgs.callPackage ./terraform-provider-vpsadmin.nix {};
|
pkgs.callPackage ./terraform-provider-vpsadmin.nix { };
|
||||||
|
|
||||||
terraform = pkgs.terraform.withPlugins (
|
terraform = pkgs.terraform.withPlugins (
|
||||||
p: [
|
p: [
|
||||||
|
@ -20,10 +20,9 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
(self: super: { sources = import ./sources.nix; })
|
(self: super: { sources = import ./sources.nix; })
|
||||||
(self: super: {
|
(self: super: {
|
||||||
nix-community-infra = nix-community-infra super;
|
nix-community-infra = nix-community-infra super;
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# This file has been generated by Niv.
|
# This file has been generated by Niv.
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
#
|
#
|
||||||
# The fetchers. fetch_<type> fetches specs of type <type>.
|
# The fetchers. fetch_<type> fetches specs of type <type>.
|
||||||
#
|
#
|
||||||
|
@ -10,29 +8,29 @@ let
|
||||||
let
|
let
|
||||||
name' = sanitizeName name + "-src";
|
name' = sanitizeName name + "-src";
|
||||||
in
|
in
|
||||||
if spec.builtin or true then
|
if spec.builtin or true then
|
||||||
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
||||||
else
|
else
|
||||||
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
||||||
|
|
||||||
fetch_tarball = pkgs: name: spec:
|
fetch_tarball = pkgs: name: spec:
|
||||||
let
|
let
|
||||||
name' = sanitizeName name + "-src";
|
name' = sanitizeName name + "-src";
|
||||||
in
|
in
|
||||||
if spec.builtin or true then
|
if spec.builtin or true then
|
||||||
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
||||||
else
|
else
|
||||||
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
||||||
|
|
||||||
fetch_git = name: spec:
|
fetch_git = name: spec:
|
||||||
let
|
let
|
||||||
ref =
|
ref =
|
||||||
if spec ? ref then spec.ref else
|
if spec ? ref then spec.ref else
|
||||||
if spec ? branch then "refs/heads/${spec.branch}" else
|
if spec ? branch then "refs/heads/${spec.branch}" else
|
||||||
if spec ? tag then "refs/tags/${spec.tag}" else
|
if spec ? tag then "refs/tags/${spec.tag}" else
|
||||||
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
||||||
in
|
in
|
||||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
|
builtins.fetchGit { url = spec.repo; inherit (spec) rev;inherit ref; };
|
||||||
|
|
||||||
fetch_local = spec: spec.path;
|
fetch_local = spec: spec.path;
|
||||||
|
|
||||||
|
@ -66,16 +64,16 @@ let
|
||||||
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
||||||
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
||||||
in
|
in
|
||||||
if builtins.hasAttr "nixpkgs" sources
|
if builtins.hasAttr "nixpkgs" sources
|
||||||
then sourcesNixpkgs
|
then sourcesNixpkgs
|
||||||
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
||||||
import <nixpkgs> {}
|
import <nixpkgs> { }
|
||||||
else
|
else
|
||||||
abort
|
abort
|
||||||
''
|
''
|
||||||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
||||||
add a package called "nixpkgs" to your sources.json.
|
add a package called "nixpkgs" to your sources.json.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# The actual fetching function.
|
# The actual fetching function.
|
||||||
fetch = pkgs: name: spec:
|
fetch = pkgs: name: spec:
|
||||||
|
@ -98,7 +96,7 @@ let
|
||||||
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
||||||
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
||||||
in
|
in
|
||||||
if ersatz == "" then drv else ersatz;
|
if ersatz == "" then drv else ersatz;
|
||||||
|
|
||||||
# Ports of functions for older nix versions
|
# Ports of functions for older nix versions
|
||||||
|
|
||||||
|
@ -109,7 +107,7 @@ let
|
||||||
);
|
);
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
||||||
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
|
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
|
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
|
||||||
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
|
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
|
||||||
|
@ -120,43 +118,46 @@ let
|
||||||
concatStrings = builtins.concatStringsSep "";
|
concatStrings = builtins.concatStringsSep "";
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
|
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
|
||||||
optionalAttrs = cond: as: if cond then as else {};
|
optionalAttrs = cond: as: if cond then as else { };
|
||||||
|
|
||||||
# fetchTarball version that is compatible between all the versions of Nix
|
# fetchTarball version that is compatible between all the versions of Nix
|
||||||
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
|
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
|
||||||
let
|
let
|
||||||
inherit (builtins) lessThan nixVersion fetchTarball;
|
inherit (builtins) lessThan nixVersion fetchTarball;
|
||||||
in
|
in
|
||||||
if lessThan nixVersion "1.12" then
|
if lessThan nixVersion "1.12" then
|
||||||
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
||||||
else
|
else
|
||||||
fetchTarball attrs;
|
fetchTarball attrs;
|
||||||
|
|
||||||
# fetchurl version that is compatible between all the versions of Nix
|
# fetchurl version that is compatible between all the versions of Nix
|
||||||
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
|
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
|
||||||
let
|
let
|
||||||
inherit (builtins) lessThan nixVersion fetchurl;
|
inherit (builtins) lessThan nixVersion fetchurl;
|
||||||
in
|
in
|
||||||
if lessThan nixVersion "1.12" then
|
if lessThan nixVersion "1.12" then
|
||||||
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
||||||
else
|
else
|
||||||
fetchurl attrs;
|
fetchurl attrs;
|
||||||
|
|
||||||
# Create the final "sources" from the config
|
# Create the final "sources" from the config
|
||||||
mkSources = config:
|
mkSources = config:
|
||||||
mapAttrs (
|
mapAttrs
|
||||||
name: spec:
|
(
|
||||||
if builtins.hasAttr "outPath" spec
|
name: spec:
|
||||||
then abort
|
if builtins.hasAttr "outPath" spec
|
||||||
"The values in sources.json should not have an 'outPath' attribute"
|
then
|
||||||
else
|
abort
|
||||||
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
"The values in sources.json should not have an 'outPath' attribute"
|
||||||
) config.sources;
|
else
|
||||||
|
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
||||||
|
)
|
||||||
|
config.sources;
|
||||||
|
|
||||||
# The "config" used by the fetchers
|
# The "config" used by the fetchers
|
||||||
mkConfig =
|
mkConfig =
|
||||||
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
||||||
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
|
, sources ? if isNull sourcesFile then { } else builtins.fromJSON (builtins.readFile sourcesFile)
|
||||||
, system ? builtins.currentSystem
|
, system ? builtins.currentSystem
|
||||||
, pkgs ? mkPkgs sources system
|
, pkgs ? mkPkgs sources system
|
||||||
}: rec {
|
}: rec {
|
||||||
|
@ -168,4 +169,4 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
|
@ -11,7 +11,7 @@ in
|
||||||
n = builtins.map (c: lib.mod (ord c) 10) chars;
|
n = builtins.map (c: lib.mod (ord c) 10) chars;
|
||||||
s = builtins.concatStringsSep "" (builtins.map (i: builtins.toString i) n);
|
s = builtins.concatStringsSep "" (builtins.map (i: builtins.toString i) n);
|
||||||
in
|
in
|
||||||
assert builtins.stringLength id >= 4;
|
assert builtins.stringLength id >= 4;
|
||||||
assert builtins.length chars == 4;
|
assert builtins.length chars == 4;
|
||||||
1000 + lib.toInt s;
|
1000 + lib.toInt s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
userLib = import ./lib.nix { inherit lib; };
|
userLib = import ./lib.nix { inherit lib; };
|
||||||
keys = [
|
keys = [
|
||||||
|
|
Loading…
Add table
Reference in a new issue