This commit is contained in:
Dmitriy Kholkin 2020-08-04 01:46:48 +04:00
parent 1565ee0a23
commit 8e2daeb5be
16 changed files with 364 additions and 389 deletions

View File

@ -1,19 +1,12 @@
# This is AlukardBF's configuration file.
# Thanks for original config - balsoft.
# https://github.com/AlukardBF/nixos-config
{ config, pkgs, lib, inputs, name, ... }:
rec {
device = name;
device:
{ config, pkgs, lib, ... }:
let sources = import ./nix/sources.nix;
in {
imports = [
"${./hardware-configuration}/${device}.nix"
"${sources.home-manager}/nixos"
(./hardware-configuration + "/${name}.nix")
inputs.home-manager.nixosModules.home-manager
(import ./modules device)
];
inherit device;
system.stateVersion = "19.03";
system.stateVersion = "20.03";
}

213
flake.lock generated Normal file
View File

@ -0,0 +1,213 @@
{
"nodes": {
"base16-horizon-scheme": {
"flake": false,
"locked": {
"lastModified": 1561359199,
"narHash": "sha256-A8v9S2+WHvKi7r7jIuf2igVkDEwb79bMLYzzsj/4CLE=",
"owner": "AlukardBF",
"repo": "base16-horizon-scheme",
"rev": "644d073863ba9f863eef3b88a8f8607d0ace0063",
"type": "github"
},
"original": {
"owner": "AlukardBF",
"repo": "base16-horizon-scheme",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1591751635,
"narHash": "sha256-KgGtyFlkI/fsp+j8VEgJ/ynY9B91aX35Xp04HlDLRTo=",
"owner": "rycee",
"repo": "home-manager",
"rev": "b3fee796fcd5531693d9b84ece76ad6836bb1cfa",
"type": "github"
},
"original": {
"owner": "rycee",
"ref": "bqv-flakes",
"repo": "home-manager",
"type": "github"
}
},
"i3lock-fancy-rapid": {
"flake": false,
"locked": {
"lastModified": 1570642358,
"narHash": "sha256-hs1MHGVN/xysUdkg9NxfQocvSOtyvpuGAKdzs42kG0o=",
"owner": "yvbbrjdr",
"repo": "i3lock-fancy-rapid",
"rev": "c67f09bc8a48798c7c820d7d4749240b10865ce0",
"type": "github"
},
"original": {
"owner": "yvbbrjdr",
"repo": "i3lock-fancy-rapid",
"type": "github"
}
},
"materia-theme": {
"flake": false,
"locked": {
"lastModified": 1596129804,
"narHash": "sha256-Vtyja8A6SfeRA78XK1e89hwWYY0kQm1VkY7/EagDXl8=",
"owner": "nana-4",
"repo": "materia-theme",
"rev": "6f7e51a97fc7ff3ddbb7908cff505a8c1919b6a2",
"type": "github"
},
"original": {
"owner": "nana-4",
"repo": "materia-theme",
"type": "github"
}
},
"nix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1596472492,
"narHash": "sha256-tDghU8H3KU2LP6SY6HtugEBtEdQmPN2TfW8FgS/kCKs=",
"owner": "NixOS",
"repo": "nix",
"rev": "24e07c428f21f28df2a41a7a9851d5867f34753a",
"type": "github"
},
"original": {
"id": "nix",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1591748508,
"narHash": "sha256-GdYYaYsSBgYUhbDT1JJQ7vEgo8FWeW/AW7/qqJuCvRA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1d8c4410687390f9b8f92dbe6ff39fd8fc2b17c6",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1591633336,
"narHash": "sha256-oVXv4xAnDJB03LvZGbC72vSVlIbbJr8tpjEW5o/Fdek=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "70717a337f7ae4e486ba71a500367cad697e5f09",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-20.03-small",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1596265691,
"narHash": "sha256-9ofCzFqttTsGrvTaS4RrDSTNQO9PFOz5uyn8V+2eA5M=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "840c782d507d60aaa49aa9e3f6d0b0e780912742",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"base16-horizon-scheme": "base16-horizon-scheme",
"home-manager": "home-manager",
"i3lock-fancy-rapid": "i3lock-fancy-rapid",
"materia-theme": "materia-theme",
"nix": "nix",
"nixpkgs": "nixpkgs_3",
"spotify-tui": "spotify-tui",
"zsh-autosuggestions": "zsh-autosuggestions",
"zsh-nix-shell": "zsh-nix-shell",
"zsh-you-should-use": "zsh-you-should-use"
}
},
"spotify-tui": {
"flake": false,
"locked": {
"lastModified": 1595589659,
"narHash": "sha256-Jqn27cWY3e7Swpe5zEwhtHaYdJu1+D1k4e6cd2D2fGk=",
"owner": "Rigellute",
"repo": "spotify-tui",
"rev": "10e8d9e5f9887820f7cff6531357088d44816f86",
"type": "github"
},
"original": {
"owner": "Rigellute",
"repo": "spotify-tui",
"type": "github"
}
},
"zsh-autosuggestions": {
"flake": false,
"locked": {
"lastModified": 1578370341,
"narHash": "sha256-xv4eleksJzomCtLsRUj71RngIJFw8+A31O6/p7i4okA=",
"owner": "zsh-users",
"repo": "zsh-autosuggestions",
"rev": "ae315ded4dba10685dbbafbfa2ff3c1aefeb490d",
"type": "github"
},
"original": {
"owner": "zsh-users",
"repo": "zsh-autosuggestions",
"type": "github"
}
},
"zsh-nix-shell": {
"flake": false,
"locked": {
"lastModified": 1593533321,
"narHash": "sha256-r4B4EjZrOrJrJb4GVkJA7X7GfXCbcqkW549uwTno1vg=",
"owner": "chisui",
"repo": "zsh-nix-shell",
"rev": "6ae30544a284301026d4ee1c437b44f5d1a9952e",
"type": "github"
},
"original": {
"owner": "chisui",
"repo": "zsh-nix-shell",
"type": "github"
}
},
"zsh-you-should-use": {
"flake": false,
"locked": {
"lastModified": 1594759444,
"narHash": "sha256-WCltJcamURZymBegL+wNjRBzZWy1OblWY6CcKU0rAS8=",
"owner": "MichaelAquilina",
"repo": "zsh-you-should-use",
"rev": "b4aec740f23d195116d1fddec91d67b5e9c2c5c7",
"type": "github"
},
"original": {
"owner": "MichaelAquilina",
"repo": "zsh-you-should-use",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

78
flake.nix Normal file
View File

@ -0,0 +1,78 @@
{
description = "System configuration";
inputs = {
# nixpkgs = github:nixos/nixpkgs-channels/840c782d507d60aaa49aa9e3f6d0b0e780912742;
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
home-manager.url = github:rycee/home-manager/bqv-flakes;
base16-horizon-scheme = {
url = github:AlukardBF/base16-horizon-scheme;
flake = false;
};
materia-theme = {
url = github:nana-4/materia-theme;
flake = false;
};
zsh-autosuggestions = {
url = github:zsh-users/zsh-autosuggestions;
flake = false;
};
zsh-nix-shell = {
url = github:chisui/zsh-nix-shell;
flake = false;
};
zsh-you-should-use = {
url = github:MichaelAquilina/zsh-you-should-use;
flake = false;
};
i3lock-fancy-rapid = {
url = github:yvbbrjdr/i3lock-fancy-rapid;
flake = false;
};
spotify-tui = {
url = github:Rigellute/spotify-tui;
flake = false;
};
};
# outputs = inputs@{ nixpkgs, ... }: {
# nixosConfigurations.NixOS-VM =
# let
# name = "NixOS-VM";
# in nixpkgs.lib.nixosSystem {
# modules = [ (import ./default.nix) ];
# # Select the target system here.
# system = "x86_64-linux";
# specialArgs = { inherit inputs name; };
# };
# };
outputs = { nixpkgs, nix, self, ... }@inputs: {
nixosConfigurations = with nixpkgs.lib;
let
hosts = map (fname: builtins.head (builtins.match "(.*)\\.nix" fname))
(builtins.attrNames (builtins.readDir ./hardware-configuration));
mkHost = name:
nixosSystem {
system = "x86_64-linux";
modules = [ (import ./default.nix) ];
specialArgs = { inherit inputs name; };
};
in genAttrs hosts mkHost;
legacyPackages.x86_64-linux =
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
# nix run github:serokell/deploy
# Because sudo requires local presence of my Yubikey, we have to manually activate the system
# sudo nix-env -p /nix/var/nix/profiles/system --set /nix/var/nix/profiles/per-user/alukard/system;
# sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
deploy = {
user = "alukard";
nodes = builtins.mapAttrs (_: conf: {
hostname = conf.config.networking.hostName;
profiles.system.path = conf.config.system.build.toplevel;
}) self.nixosConfigurations;
};
};
}

View File

@ -1,12 +1,11 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
[ "${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];

5
hardware-configuration/Dell-Laptop.nix Executable file → Normal file
View File

@ -1,12 +1,11 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
[ "${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];

View File

@ -0,0 +1,27 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, inputs, ... }:
{
imports = [ ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/e9d79e40-9a7c-490f-9fc3-8ba36e1ee856";
fsType = "f2fs";
};
fileSystems."/boot" =
{ device = "/dev/sda1";
fsType = "vfat";
};
swapDevices = [ ];
virtualisation.virtualbox.guest.enable = true;
}

View File

@ -1,7 +1,7 @@
{ stdenv, fetchFromGitHub, i3lock, xorg, imports }:
{ stdenv, fetchFromGitHub, i3lock, xorg, inputs }:
stdenv.mkDerivation rec {
name = "i3lock-fancy-rapid";
src = imports.i3lock-fancy-rapid;
src = inputs.i3lock-fancy-rapid;
# src = fetchFromGitHub {
# owner = "yvbbrjdr";
# repo = "i3lock-fancy-rapid";

View File

@ -1,22 +0,0 @@
{ buildGoModule, fetchFromGitHub, lib }:
buildGoModule rec {
pname = "spicetify-cli";
version = "0.9.7";
src = fetchFromGitHub {
owner = "khanhas";
repo = "spicetify-cli";
rev = "v${version}";
sha256 = "1zvihjzv4q4pshvwjjia27vkzcn24phrs5cadc7gbl1mqr3zyac6";
};
modSha256 = "1q6vvy2xz2wm2wzpjk04hbfmsjm72wfa3kxfnnc8b4gxhdhw50ql";
meta = with lib; {
description = "Commandline tool to customize Spotify client. Supports Windows, MacOS and Linux.";
homepage = https://github.com/khanhas/spicetify-cli;
license = licenses.gpl3;
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};
}

View File

@ -1,7 +0,0 @@
{ config, lib, pkgs, ...}:
let
naersk = pkgs.callPackage pkgs.imports.naersk {};
in naersk.buildPackage {
name = "spotify-tui";
src = pkgs.imports.spotify-tui;
};

View File

@ -27,6 +27,6 @@
};
firewall.enable = false;
usePredictableInterfaceNames = false;
hostName = config.deviceSpecific.hostName;
hostName = config.device;
};
}

View File

@ -1,15 +1,11 @@
{ pkgs, config, lib, ... }:
let
imports = import ../nix/sources.nix;
mozilla_overlay = import imports.nixpkgs-mozilla;
in {
{ pkgs, config, lib, inputs, ... }:
{
nixpkgs.overlays = [
mozilla_overlay
inputs.nix.overlay
# mozilla_overlay
(self: super:
rec {
inherit imports;
# naersk = pkgs.callPackage pkgs.imports.naersk {};
inherit inputs;
youtube-to-mpv = pkgs.callPackage ./applications/youtube-to-mpv.nix { };
@ -21,11 +17,9 @@ in {
git-with-libsecret = super.git.override { withLibsecret = true; };
spotifyd = super.spotifyd.override { withPulseAudio = true; };
# spotifyd = super.spotifyd.override { withPulseAudio = true; };
spicetify-cli = pkgs.callPackage ./applications/spicetify-cli.nix { };
tlp = pkgs.callPackage ./applications/tlp { };
# tlp = pkgs.callPackage ./applications/tlp { };
# spotify-tui = pkgs.callPackage ./applications/spotify-tui.nix { };
@ -34,42 +28,35 @@ in {
# src = pkgs.imports.spotify-tui;
# buildInputs = [ pkgs.pkgconf pkgs.openssl ];
# };
# mopidy = super.mopidy.overridePythonAttrs (oa: {
# src = imports.mopidy;
# propagatedBuildInputs = with self.python27Packages; [
# gst-python
# pygobject3
# pykka
# tornado_4
# requests
# setuptools
# dbus-python
# protobuf
# ];
# });
}
)
];
# nixpkgs.config.packageOverrides = pkgs: {
# spotifyd = pkgs.spotifyd.override { withPulseAudio = true; };
# spotify-tui = pkgs.callPackage ./applications/spotify-tui.nix { };
# };
nixpkgs.config = {
allowUnfree = true;
};
nixpkgs.pkgs = import imports.nixpkgs {
config.allowUnfree = true;
} // config.nixpkgs.config;
environment.etc.nixpkgs.source = inputs.nixpkgs;
nix = rec {
useSandbox = true;
autoOptimiseStore = config.deviceSpecific.isSSD;
optimise.automatic = true;
# Change nixpkgs path to niv source
nixPath = [
"nixpkgs=${imports.nixpkgs}"
nixPath = lib.mkForce [
"nixpkgs=/etc/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
extraOptions = ''
experimental-features = nix-command flakes
'';
# package = pkgs.nixFlakes;
package = inputs.nix.packages.x86_64-linux.nix;
registry.self.flake = inputs.self;
};
}

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
with lib;
let
colorType = types.str;
@ -64,6 +64,6 @@ in {
};
config = {
themes.colors = fromBase16 (fromYAML (builtins.readFile
"${pkgs.imports.base16-horizon-scheme}/horizon-dark.yaml"));
"${inputs.base16-horizon-scheme}/horizon-dark.yaml"));
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }:
{ pkgs, config, lib, inputs, ... }:
let
thm = config.themes.colors;
thm' = builtins.mapAttrs (name: value: builtins.substring 1 7 value) thm;
@ -30,7 +30,7 @@ in {
nixpkgs.overlays = [(self: super: {
generated-gtk-theme = self.stdenv.mkDerivation rec {
name = "generated-gtk-theme";
src = pkgs.imports.materia-theme;
src = inputs.materia-theme;
buildInputs = with self; [ sassc bc which inkscape optipng ];
installPhase = ''
HOME=/build

View File

@ -1,4 +1,4 @@
{ pkgs, config, ... }: {
{ pkgs, config, inputs, ... }: {
environment.pathsToLink = [ "/share/zsh" ];
environment.sessionVariables.SHELL = "zsh";
@ -15,15 +15,15 @@
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.imports.zsh-nix-shell;
src = inputs.zsh-nix-shell;
}
{
name = "zsh-autosuggestions";
src = pkgs.imports.zsh-autosuggestions;
src = inputs.zsh-autosuggestions;
}
{
name = "you-should-use";
src = pkgs.imports.zsh-you-should-use;
src = inputs.zsh-you-should-use;
}
];
shellAliases = {

View File

@ -1,158 +0,0 @@
{
"base16-horizon-scheme": {
"branch": "master",
"description": null,
"homepage": null,
"owner": "AlukardBF",
"repo": "base16-horizon-scheme",
"rev": "644d073863ba9f863eef3b88a8f8607d0ace0063",
"sha256": "1c88z0zv5wwc5p6ddvqv9h6681cayvkj5qxyxsig47lndx5zvjq3",
"type": "tarball",
"url": "https://github.com/AlukardBF/base16-horizon-scheme/archive/644d073863ba9f863eef3b88a8f8607d0ace0063.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"home-manager": {
"branch": "master",
"description": "Manage a user environment using Nix",
"homepage": "",
"owner": "rycee",
"repo": "home-manager",
"rev": "41094aa3c7674e5278ea681397285421fd18e44b",
"sha256": "026982zk48m4ipdghrjg9cppqza1avprzm2cdc9h72pgk6nc3r2d",
"type": "tarball",
"url": "https://github.com/rycee/home-manager/archive/41094aa3c7674e5278ea681397285421fd18e44b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"i3lock-fancy-rapid": {
"branch": "master",
"description": "A faster implementation of i3lock-fancy.",
"homepage": null,
"owner": "yvbbrjdr",
"repo": "i3lock-fancy-rapid",
"rev": "c67f09bc8a48798c7c820d7d4749240b10865ce0",
"sha256": "0jhvlj6v6wx70239pgkjxd42z1s2bzfg886ra6n1rzsdclf4rkc6",
"type": "tarball",
"url": "https://github.com/yvbbrjdr/i3lock-fancy-rapid/archive/c67f09bc8a48798c7c820d7d4749240b10865ce0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"materia-theme": {
"branch": "master",
"description": "A Material Design theme for GNOME/GTK based desktop environments",
"homepage": "",
"owner": "nana-4",
"repo": "materia-theme",
"rev": "b1e4c563146ae34fff6a697393b6a1bc66b612f5",
"sha256": "1w65v7jl8v5h41d27gj79rnkbn8rw0avrj4gi57l8lvlhpn9q6a2",
"type": "tarball",
"url": "https://github.com/nana-4/materia-theme/archive/b1e4c563146ae34fff6a697393b6a1bc66b612f5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"mopidy": {
"branch": "develop",
"description": "Mopidy is an extensible music server written in Python",
"homepage": "https://mopidy.com",
"owner": "mopidy",
"repo": "mopidy",
"rev": "49508ee030c35d9a40576637ee9e310b6d402ff8",
"sha256": "1n9lpgq0p112cjgsrc1cd6mnffk56y36g2c5skk9cqzw27qrkd15",
"type": "tarball",
"url": "https://github.com/mopidy/mopidy/archive/49508ee030c35d9a40576637ee9e310b6d402ff8.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"naersk": {
"branch": "master",
"description": "Build rust crates in Nix. No configuration, no code generation. IFD and sandbox friendly.",
"homepage": "",
"owner": "nmattia",
"repo": "naersk",
"rev": "1dd63230066a93c61ab7a66934eb0aae3f1a3613",
"sha256": "1xn8m62ypg13jh4zf101qmfa6gy8cl923fgwvk9c33m573h3k154",
"type": "tarball",
"url": "https://github.com/nmattia/naersk/archive/1dd63230066a93c61ab7a66934eb0aae3f1a3613.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "f73bf8d584148677b01859677a63191c31911eae",
"sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-unstable",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs-channels",
"rev": "39247f8d04c04b3ee629a1f85aeedd582bf41cac",
"sha256": "1q7asvk73w7287d2ghgya2hnvn01szh65n8xczk4x2b169c5rfv0",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/39247f8d04c04b3ee629a1f85aeedd582bf41cac.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-mozilla": {
"branch": "master",
"description": "mozilla related nixpkgs (extends nixos/nixpkgs repo)",
"homepage": null,
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "e912ed483e980dfb4666ae0ed17845c4220e5e7c",
"sha256": "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3",
"type": "tarball",
"url": "https://github.com/mozilla/nixpkgs-mozilla/archive/e912ed483e980dfb4666ae0ed17845c4220e5e7c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"spotify-tui": {
"branch": "master",
"description": "Spotify for the terminal written in Rust 🚀",
"homepage": null,
"owner": "Rigellute",
"repo": "spotify-tui",
"rev": "5e76da45b5aad4a42beafc7eb59d80c25e2148c4",
"sha256": "06nm56362rndi14prl533zg3smgd8zd83y5k66165b8215b3k3g3",
"type": "tarball",
"url": "https://github.com/Rigellute/spotify-tui/archive/5e76da45b5aad4a42beafc7eb59d80c25e2148c4.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"zsh-autosuggestions": {
"branch": "master",
"description": "Fish-like autosuggestions for zsh",
"homepage": null,
"owner": "zsh-users",
"repo": "zsh-autosuggestions",
"rev": "ae315ded4dba10685dbbafbfa2ff3c1aefeb490d",
"sha256": "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6",
"type": "tarball",
"url": "https://github.com/zsh-users/zsh-autosuggestions/archive/ae315ded4dba10685dbbafbfa2ff3c1aefeb490d.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"zsh-nix-shell": {
"branch": "master",
"description": "zsh plugin that lets you use zsh in nix-shell shell.",
"homepage": "",
"owner": "chisui",
"repo": "zsh-nix-shell",
"rev": "69e90b9bccecd84734948fb03087c2454a8522f6",
"sha256": "0snhch9hfy83d4amkyxx33izvkhbwmindy0zjjk28hih1a9l2jmx",
"type": "tarball",
"url": "https://github.com/chisui/zsh-nix-shell/archive/69e90b9bccecd84734948fb03087c2454a8522f6.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"zsh-you-should-use": {
"branch": "master",
"description": "📎 ZSH plugin that reminds you to use existing aliases for commands you just typed",
"homepage": "",
"owner": "MichaelAquilina",
"repo": "zsh-you-should-use",
"rev": "888da3af69162c927e0f933ab8dc12395a52ad67",
"sha256": "1gcxm08ragwrh242ahlq3bpfg5yma2cshwdlj8nrwnd4qwrsflgq",
"type": "tarball",
"url": "https://github.com/MichaelAquilina/zsh-you-should-use/archive/888da3af69162c927e0f933ab8dc12395a52ad67.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

View File

@ -1,134 +0,0 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: spec:
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; }
else
pkgs.fetchurl { inherit (spec) url sha256; };
fetch_tarball = pkgs: spec:
if spec.builtin or true then
builtins_fetchTarball { inherit (spec) url sha256; }
else
pkgs.fetchzip { inherit (spec) url sha256; };
fetch_git = spec:
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
fetch_builtin-tarball = spec:
builtins.trace
''
WARNING:
The niv type "builtin-tarball" will soon be deprecated. You should
instead use `builtin = true`.
$ niv modify <package> -a type=tarball -a builtin=true
''
builtins_fetchTarball { inherit (spec) url sha256; };
fetch_builtin-url = spec:
builtins.trace
''
WARNING:
The niv type "builtin-url" will soon be deprecated. You should
instead use `builtin = true`.
$ niv modify <package> -a type=file -a builtin=true
''
(builtins_fetchurl { inherit (spec) url sha256; });
#
# Various helpers
#
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs spec
else if spec.type == "tarball" then fetch_tarball pkgs spec
else if spec.type == "git" then fetch_git spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
else if spec.type == "builtin-url" then fetch_builtin-url spec
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball { inherit url; }
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl { inherit url; }
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = fetch config.pkgs name spec; }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? ./sources.json
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
, pkgs ? mkPkgs sources
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }