change formatter to nixfmt

This commit is contained in:
Timothy DeHerrera 2020-01-03 22:06:31 -07:00
parent 916add2921
commit 16b8136f50
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
31 changed files with 226 additions and 420 deletions

View File

@ -151,7 +151,7 @@ the `template` branch to provide a host of useful NixOS configurations available
"out of the box". If you wish to contribute such an expression please follow "out of the box". If you wish to contribute such an expression please follow
these guidelines: these guidelines:
* format your code with [`nixpkgs-fmt`][nixpkgs-fmt] * format your code with [`nixfmt`][nixfmt]
* The commit message follows the same semantics as [nixpkgs][nixpkgs]. * The commit message follows the same semantics as [nixpkgs][nixpkgs].
* You can use a `#` symbol to specify abiguities. For example, * You can use a `#` symbol to specify abiguities. For example,
`develop#zsh: <rest of commit message>` would tell me that your updating the `develop#zsh: <rest of commit message>` would tell me that your updating the
@ -173,7 +173,7 @@ licenses of the respective packages.
[direnv]: https://direnv.net [direnv]: https://direnv.net
[home-manager]: https://github.com/rycee/home-manager [home-manager]: https://github.com/rycee/home-manager
[NixOS]: https://nixos.org [NixOS]: https://nixos.org
[nixpkgs-fmt]: https://github.com/nix-community/nixpkgs-fmt [nixfmt]: https://github.com/serokell/nixfmt
[nixpkgs]: https://github.com/NixOS/nixpkgs [nixpkgs]: https://github.com/NixOS/nixpkgs
[old]: https://github.com/nrdxp/nixos [old]: https://github.com/nrdxp/nixos
[pr]: https://github.com/NixOS/nixpkgs/pull/68897 [pr]: https://github.com/NixOS/nixpkgs/pull/68897

View File

@ -5,23 +5,22 @@
let let
hostname = lib.fileContents /etc/hostname; hostname = lib.fileContents /etc/hostname;
host = "/etc/nixos/hosts/${hostname}.nix"; host = "/etc/nixos/hosts/${hostname}.nix";
config = config = if (builtins.pathExists host) then
if (builtins.pathExists host) [ host ]
then [ host ] else
else [ /etc/nixos/hosts/NixOS.nix ]; [ /etc/nixos/hosts/NixOS.nix ];
in in {
{
imports = builtins.attrValues (import ./modules) ++ [ imports = builtins.attrValues (import ./modules) ++ [
"${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" "${
builtins.fetchTarball
"https://github.com/rycee/home-manager/archive/master.tar.gz"
}/nixos"
/etc/nixos/profiles/core.nix /etc/nixos/profiles/core.nix
] ++ config; ] ++ config;
networking.hostName = hostname; networking.hostName = hostname;
nix.nixPath = [ nix.nixPath =
"nixpkgs=${<nixpkgs>}" [ "nixpkgs=${<nixpkgs>}" "nixos-config=/etc/nixos/configuration.nix" ];
"nixos-config=/etc/nixos/configuration.nix"
];
nixpkgs.overlays = lib.singleton (import ./pkgs); nixpkgs.overlays = lib.singleton (import ./pkgs);
} }

View File

@ -6,18 +6,16 @@
inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork"; inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork";
inputs.home.url = "github:nrdxp/home-manager/flakes"; inputs.home.url = "github:nrdxp/home-manager/flakes";
outputs = args@{ self, home, nixpkgs }: let outputs = args@{ self, home, nixpkgs }:
let
pkgs = import nixpkgs { pkgs = import nixpkgs {
system = "x86_64-linux"; system = "x86_64-linux";
overlays = self.overlays; overlays = self.overlays;
}; };
in in {
{ nixosConfigurations = let configs = import ./hosts args;
nixosConfigurations = let
configs = import ./hosts args;
in in configs;
configs;
overlay = import ./pkgs; overlay = import ./pkgs;
@ -27,8 +25,6 @@
inherit (pkgs) sddm-chili dejavu_nerdfont purs; inherit (pkgs) sddm-chili dejavu_nerdfont purs;
}; };
nixosModules = (import ./modules) // { nixosModules = (import ./modules) // { profiles = import ./profiles; };
profiles = import ./profiles;
};
}; };
} }

View File

@ -1,6 +1 @@
{ { imports = [ ../profiles/develop ../profiles/misc ]; }
imports = [
../profiles/develop
../profiles/misc
];
}

View File

@ -2,15 +2,9 @@ args@{ home, nixpkgs, self, ... }:
let let
utils = import ../lib/utils.nix { lib = nixpkgs.lib; }; utils = import ../lib/utils.nix { lib = nixpkgs.lib; };
inherit (utils) inherit (utils) recImport;
recImport
;
inherit (builtins)
attrValues
removeAttrs
;
inherit (builtins) attrValues removeAttrs;
config = this: config = this:
nixpkgs.lib.nixosSystem rec { nixpkgs.lib.nixosSystem rec {
@ -32,20 +26,15 @@ let
local = import "${toString ./.}/${this}.nix"; local = import "${toString ./.}/${this}.nix";
flakeModules = removeAttrs self.nixosModules flakeModules = removeAttrs self.nixosModules [ "profiles" ];
[ "profiles" ];
in in attrValues flakeModules
attrValues flakeModules ++ [ ++ [ core global local home.nixosModules.home-manager ];
core
global
local
home.nixosModules.home-manager
];
}; };
hosts = hosts = recImport {
recImport { dir = ./.; _import = config; }; dir = ./.;
in _import = config;
hosts };
in hosts

View File

@ -1,9 +1,5 @@
{ modulesPath, ... }: { modulesPath, ... }: {
{ imports = [ ./NixOS.nix "${modulesPath}/installer/cd-dvd/iso-image.nix" ];
imports = [
./NixOS.nix
"${modulesPath}/installer/cd-dvd/iso-image.nix"
];
isoImage.makeEfiBootable = true; isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true; isoImage.makeUsbBootable = true;

View File

@ -1,49 +1,23 @@
{ lib, ... }: { lib, ... }:
let let
inherit (builtins) inherit (builtins) attrNames isAttrs readDir;
attrNames
isAttrs
readDir
;
inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix;
inherit (lib) in rec {
filterAttrs
hasSuffix
mapAttrs'
nameValuePair
removeSuffix
;
in
rec {
# mapFilterAttrs :: # mapFilterAttrs ::
# (name -> value -> bool ) # (name -> value -> bool )
# (name -> value -> { name = any; value = any; }) # (name -> value -> { name = any; value = any; })
# attrs # attrs
mapFilterAttrs = seive: f: attrs: mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs);
filterAttrs seive (mapAttrs' f attrs);
recImport = recImport = { dir, _import ? base: import "${dir}/${base}.nix" }:
{ dir mapFilterAttrs (_: v: v != null) (n: v:
, _import ? base: import "${dir}/${base}.nix" if n != "default.nix" && hasSuffix ".nix" n && v == "regular"
}:
mapFilterAttrs
(_: v: v != null)
(
n: v:
if
n != "default.nix"
&& hasSuffix ".nix" n
&& v == "regular"
then let then
name = removeSuffix ".nix" n; let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name)
in
nameValuePair (name) (_import name)
else else
nameValuePair ("") (null) nameValuePair ("") (null)) (readDir dir);
)
(readDir dir);
} }

View File

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
time.timeZone = "America/Denver"; time.timeZone = "America/Denver";
} }

View File

@ -1,3 +1 @@
{ { qbittorrent-nox = import ./services/torrent/qbittorrent.nix; }
qbittorrent-nox = import ./services/torrent/qbittorrent.nix;
}

View File

@ -4,8 +4,7 @@ let
cfg = config.services.qbittorrent; cfg = config.services.qbittorrent;
configDir = "${cfg.dataDir}/.config"; configDir = "${cfg.dataDir}/.config";
openFilesLimit = 4096; openFilesLimit = 4096;
in in {
{
options.services.qbittorrent = { options.services.qbittorrent = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@ -68,11 +67,9 @@ in
environment.systemPackages = [ pkgs.qbittorrent ]; environment.systemPackages = [ pkgs.qbittorrent ];
nixpkgs.overlays = [ nixpkgs.overlays = [
( (self: super: {
self: super: {
qbittorrent = super.qbittorrent.override { guiSupport = false; }; qbittorrent = super.qbittorrent.override { guiSupport = false; };
} })
)
]; ];
networking.firewall = mkIf cfg.openFirewall { networking.firewall = mkIf cfg.openFirewall {
@ -110,10 +107,7 @@ in
}; };
}; };
users.groups = mkIf (cfg.group == "qbittorrent") { users.groups =
qbittorrent = { mkIf (cfg.group == "qbittorrent") { qbittorrent = { gid = null; }; };
gid = null;
};
};
}; };
} }

View File

@ -5,7 +5,8 @@ stdenv.mkDerivation rec {
version = "2.0.0"; version = "2.0.0";
src = fetchzip { src = fetchzip {
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/DejaVuSansMono.zip"; url =
"https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/DejaVuSansMono.zip";
hash = "sha256-yMvKzt5CKpK1bThT25lqSyRvZRCFvo6HHbTj+ripdCo="; hash = "sha256-yMvKzt5CKpK1bThT25lqSyRvZRCFvo6HHbTj+ripdCo=";
stripRoot = false; stripRoot = false;
}; };
@ -15,7 +16,7 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Nerdfont version of DejaVu"; description = "Nerdfont version of DejaVu";
homepage = https://github.com/ryanoasis/nerd-fonts; homepage = "https://github.com/ryanoasis/nerd-fonts";
license = licenses.mit; license = licenses.mit;
maintainers = [ maintainers.nrdxp ]; maintainers = [ maintainers.nrdxp ];
inherit version; inherit version;

View File

@ -1,5 +1,6 @@
final: prev: { final: prev: {
sddm-chili = prev.callPackage ./applications/display-managers/sddm/themes/chili {}; sddm-chili =
dejavu_nerdfont = prev.callPackage ./data/fonts/dejavu-nerdfont {}; prev.callPackage ./applications/display-managers/sddm/themes/chili { };
purs = prev.callPackage ./shells/zsh/purs {}; dejavu_nerdfont = prev.callPackage ./data/fonts/dejavu-nerdfont { };
purs = prev.callPackage ./shells/zsh/purs { };
} }

View File

@ -2,15 +2,10 @@
with rustPlatform; with rustPlatform;
let let
inherit (builtins) inherit (builtins) readFile toFile;
readFile
toFile
;
init = toFile "init.sh" "${readFile ./init.sh}"; init = toFile "init.sh" "${readFile ./init.sh}";
in in buildRustPackage rec {
buildRustPackage rec {
pname = "purs"; pname = "purs";
version = "0.1.0"; version = "0.1.0";
@ -21,10 +16,7 @@ buildRustPackage rec {
hash = "sha256-QwkbqNROksRo+QmRrgkWuoPzPb2XBwavEtlR9oqAXDQ="; hash = "sha256-QwkbqNROksRo+QmRrgkWuoPzPb2XBwavEtlR9oqAXDQ=";
}; };
buildInputs = [ buildInputs = [ openssl pkgconfig ];
openssl
pkgconfig
];
cargoSha256 = "sha256-vyO2JRRA7FCNVmIeN1xybQXkdgoHbhMGT2AhUJEnp0s="; cargoSha256 = "sha256-vyO2JRRA7FCNVmIeN1xybQXkdgoHbhMGT2AhUJEnp0s=";
@ -37,7 +29,7 @@ buildRustPackage rec {
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A Pure-inspired prompt in Rust"; description = "A Pure-inspired prompt in Rust";
homepage = https://github.com/xcambar/purs; homepage = "https://github.com/xcambar/purs";
maintainers = [ maintainers.nrdxp ]; maintainers = [ maintainers.nrdxp ];
license = licenses.mit; license = licenses.mit;
inherit version; inherit version;

View File

@ -1,24 +1,12 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let inherit (lib) fileContents;
inherit (lib)
fileContents
;
in in {
{
nix.package = pkgs.nixFlakes; nix.package = pkgs.nixFlakes;
nix.systemFeatures = [ nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
];
imports = [
../local/locale.nix
];
imports = [ ../local/locale.nix ];
boot = { boot = {
@ -30,7 +18,6 @@ in
}; };
environment = { environment = {
systemPackages = with pkgs; [ systemPackages = with pkgs; [
@ -51,10 +38,9 @@ in
utillinux utillinux
]; ];
shellAliases = let shellAliases =
ifSudo = string: lib.mkIf config.security.sudo.enable string; let ifSudo = string: lib.mkIf config.security.sudo.enable string;
in in {
{
# quick cd # quick cd
".." = "cd .."; ".." = "cd ..";
"..." = "cd ../.."; "..." = "cd ../..";
@ -101,13 +87,8 @@ in
}; };
fonts = { fonts = {
fonts = with pkgs; [ fonts = with pkgs; [ powerline-fonts dejavu_fonts ];
powerline-fonts
dejavu_fonts
];
fontconfig.defaultFonts = { fontconfig.defaultFonts = {
@ -118,7 +99,6 @@ in
}; };
}; };
nix = { nix = {
autoOptimiseStore = true; autoOptimiseStore = true;
@ -139,10 +119,8 @@ in
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
security = { security = {
hideProcessInformation = true; hideProcessInformation = true;
@ -151,10 +129,8 @@ in
}; };
services.earlyoom.enable = true; services.earlyoom.enable = true;
users = { users = {
mutableUsers = false; mutableUsers = false;

View File

@ -1,14 +1,7 @@
{ pkgs, ... }: { pkgs, ... }: {
{ imports = [ ./zsh ./kakoune ./tmux ];
imports = [
./zsh
./kakoune
./tmux
];
environment.shellAliases = { environment.shellAliases = { v = "$EDITOR"; };
v = "$EDITOR";
};
environment.sessionVariables = { environment.sessionVariables = {
PAGER = "less"; PAGER = "less";
@ -32,9 +25,8 @@
fonts = { fonts = {
fonts = [ pkgs.dejavu_nerdfont ]; fonts = [ pkgs.dejavu_nerdfont ];
fontconfig.defaultFonts.monospace = [ fontconfig.defaultFonts.monospace =
"DejaVu Sans Mono Nerd Font Complete Mono" [ "DejaVu Sans Mono Nerd Font Complete Mono" ];
];
}; };
documentation.dev.enable = true; documentation.dev.enable = true;

View File

@ -1,11 +1,10 @@
{ pkgs, ... }: { pkgs, ... }: {
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
cquery cquery
kak-lsp kak-lsp
kakoune-config kakoune-config
kakoune-unwrapped kakoune-unwrapped
nixpkgs-fmt nixfmt
python3Packages.python-language-server python3Packages.python-language-server
rustup rustup
]; ];
@ -15,7 +14,8 @@
"xdg/kak/autoload/plugins".source = ./plugins; "xdg/kak/autoload/plugins".source = ./plugins;
"xdg/kak/autoload/lint".source = ./lint; "xdg/kak/autoload/lint".source = ./lint;
"xdg/kak/autoload/lsp".source = ./lsp; "xdg/kak/autoload/lsp".source = ./lsp;
"xdg/kak/autoload/default".source = "${pkgs.kakoune-unwrapped}/share/kak/rc"; "xdg/kak/autoload/default".source =
"${pkgs.kakoune-unwrapped}/share/kak/rc";
}; };
nixpkgs.overlays = let nixpkgs.overlays = let
@ -33,8 +33,7 @@
XDG_CONFIG_HOME=/etc/xdg exec ${self.kakoune}/bin/kak "$@" XDG_CONFIG_HOME=/etc/xdg exec ${self.kakoune}/bin/kak "$@"
''; '';
kakoune-unwrapped = super.kakoune-unwrapped.overrideAttrs ( kakoune-unwrapped = super.kakoune-unwrapped.overrideAttrs (o: rec {
o: rec {
version = "2019.12.10"; version = "2019.12.10";
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
repo = "kakoune"; repo = "kakoune";
@ -42,9 +41,7 @@
rev = "v${version}"; rev = "v${version}";
hash = "sha256-TnRQ73bIQGavXNp+wrKtYHgGem+R6JDWt333z2izYzE="; hash = "sha256-TnRQ73bIQGavXNp+wrKtYHgGem+R6JDWt333z2izYzE=";
}; };
} });
);
}; };
in in [ kak ];
[ kak ];
} }

View File

@ -12,7 +12,7 @@ hook -group lint global WinSetOption filetype=nix %{
} && run \ } && run \
' '
lint-enable lint-enable
set buffer formatcmd "nixpkgs-fmt" set buffer formatcmd "nixfmt"
hook buffer BufWritePre .* %{ hook buffer BufWritePre .* %{
format format
lint lint

View File

@ -1,25 +1,14 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let let
inherit (builtins) inherit (builtins) readFile concatStringsSep;
readFile
concatStringsSep
;
inherit (lib)
removePrefix
;
inherit (lib) removePrefix;
pluginConf = plugins: pluginConf = plugins:
concatStringsSep "\n\n" concatStringsSep "\n\n" (map (plugin:
( let name = removePrefix "tmuxplugin-" plugin.name;
map ( in "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux")
plugin: let plugins);
name = removePrefix "tmuxplugin-" plugin.name;
in
"run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux"
) plugins
);
plugins = with pkgs.tmuxPlugins; [ plugins = with pkgs.tmuxPlugins; [
copycat copycat
@ -28,11 +17,8 @@ let
yank yank
vim-tmux-navigator vim-tmux-navigator
]; ];
in in {
{ environment.shellAliases = { tx = "tmux new-session -A -s $USER"; };
environment.shellAliases = {
tx = "tmux new-session -A -s $USER";
};
programs.tmux = { programs.tmux = {
enable = true; enable = true;

View File

@ -1,28 +1,22 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let let
inherit (builtins) inherit (builtins) concatStringsSep;
concatStringsSep
;
inherit (lib) fileContents;
inherit (lib) in {
fileContents
;
in
{
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
environment = { environment = {
sessionVariables = let sessionVariables = let fd = "${pkgs.fd}/bin/fd -H";
fd = "${pkgs.fd}/bin/fd -H"; in {
in
{
BAT_PAGER = "less"; BAT_PAGER = "less";
SKIM_ALT_C_COMMAND = SKIM_ALT_C_COMMAND = let
"while read line; do " alt_c_cmd = pkgs.writeScriptBin "cdr-skim.zsh" ''
+ "line=\"'\${(Q)line}'\"; [[ -d \"'$line'\" ]] && echo \"'$line'\"; " #!${pkgs.zsh}/bin/zsh
+ "done < $HOME/.cache/zsh-cdr/recent-dirs"; ${fileContents ./cdr-skim.zsh}
'';
in "${alt_c_cmd}/bin/cdr-skim.zsh";
SKIM_DEFAULT_COMMAND = fd; SKIM_DEFAULT_COMMAND = fd;
SKIM_CTRL_T_COMMAND = fd; SKIM_CTRL_T_COMMAND = fd;
}; };
@ -62,7 +56,6 @@ in
]; ];
}; };
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -104,9 +97,7 @@ in
"${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh" "${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh"
]; ];
source = map source = map (source: "source ${source}") sources;
(source: "source ${source}")
sources;
functions = pkgs.stdenv.mkDerivation { functions = pkgs.stdenv.mkDerivation {
name = "zsh-functions"; name = "zsh-functions";
@ -116,10 +107,8 @@ in
man = "${pkgs.man}"; man = "${pkgs.man}";
exa = "${pkgs.exa}"; exa = "${pkgs.exa}";
installPhase = let installPhase = let basename = "\${file##*/}";
basename = "\${file##*/}"; in ''
in
''
mkdir $out mkdir $out
for file in $src/*; do for file in $src/*; do
@ -129,17 +118,11 @@ in
''; '';
}; };
plugins = concatStringsSep "\n" plugins = concatStringsSep "\n" ([
(
[
"${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin" "${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin"
] ++ source ] ++ source);
);
in ''
in
''
${plugins} ${plugins}
fpath+=( ${functions} ) fpath+=( ${functions} )

View File

@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, ... }: {
{
imports = [ ../graphical ./udev.nix ]; imports = [ ../graphical ./udev.nix ];
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs; [ retroarchBare steam steam-run ];
[ retroarchBare steam steam-run ];
# fps games on laptop need this # fps games on laptop need this
services.xserver.libinput.disableWhileTyping = false; services.xserver.libinput.disableWhileTyping = false;
@ -15,7 +13,5 @@
systemd.extraConfig = "DefaultLimitNOFILE=1048576"; systemd.extraConfig = "DefaultLimitNOFILE=1048576";
# improve wine performance # improve wine performance
environment.sessionVariables = { environment.sessionVariables = { WINEDEBUG = "-all"; };
WINEDEBUG = "-all";
};
} }

View File

@ -1,14 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let inherit (builtins) readFile;
inherit (builtins) in {
readFile imports = [ ./sway ../develop ];
;
in
{
imports = [
./sway
../develop
];
hardware.opengl.enable = true; hardware.opengl.enable = true;
hardware.opengl.driSupport = true; hardware.opengl.driSupport = true;
@ -35,9 +28,8 @@ in
gtk-icon-theme-name="Papirus-Adapta" gtk-icon-theme-name="Papirus-Adapta"
gtk-cursor-theme-name="Adwaita" gtk-cursor-theme-name="Adwaita"
''; '';
in in [
[ ("${pkgs.writeText "iconrc" "${gtk}"}")
(''${ pkgs.writeText "iconrc" "${gtk}" }'')
"${pkgs.adapta-gtk-theme}/share/themes/Adapta/gtk-2.0/gtkrc" "${pkgs.adapta-gtk-theme}/share/themes/Adapta/gtk-2.0/gtkrc"
"${pkgs.gnome3.gnome-themes-extra}/share/themes/Adwaita/gtk-2.0/gtkrc" "${pkgs.gnome3.gnome-themes-extra}/share/themes/Adwaita/gtk-2.0/gtkrc"
]; ];
@ -88,6 +80,5 @@ in
libopus = prev.libopus; libopus = prev.libopus;
}; };
}; };
in in [ overlay ];
[ overlay ];
} }

View File

@ -1,15 +1,11 @@
{ pkgs, ... }: { pkgs, ... }:
let let inherit (builtins) readFile;
inherit (builtins) readFile; in {
in
{
sound.enable = true; sound.enable = true;
environment = { environment = {
etc."xdg/qutebrowser/config.py".text = let etc."xdg/qutebrowser/config.py".text = let mpv = "${pkgs.mpv}/bin/mpv";
mpv = "${pkgs.mpv}/bin/mpv"; in ''
in
''
${readFile ./config.py} ${readFile ./config.py}
config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}') config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}')
@ -18,12 +14,7 @@ in
sessionVariables.BROWSER = "qute"; sessionVariables.BROWSER = "qute";
systemPackages = with pkgs; [ systemPackages = with pkgs; [ qute qutebrowser mpv youtubeDL ];
qute
qutebrowser
mpv
youtubeDL
];
}; };
nixpkgs.overlays = let nixpkgs.overlays = let
@ -32,6 +23,5 @@ in
exec ${prev.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@" exec ${prev.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@"
''; '';
}; };
in in [ overlay ];
[ overlay ];
} }

View File

@ -1,17 +1,10 @@
{ lib, config, options, pkgs, ... }: { lib, config, options, pkgs, ... }:
let let
inherit (builtins) inherit (builtins) readFile;
readFile
;
inherit (config.hardware) inherit (config.hardware) pulseaudio;
pulseaudio in {
; imports = [ ../qutebrowser ];
in
{
imports = [
../qutebrowser
];
sound.enable = true; sound.enable = true;
@ -28,8 +21,8 @@ in
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
''; '';
extraPackages = with pkgs; options.programs.sway.extraPackages.default extraPackages = with pkgs;
++ [ options.programs.sway.extraPackages.default ++ [
dmenu dmenu
networkmanager_dmenu networkmanager_dmenu
qt5.qtwayland qt5.qtwayland
@ -37,15 +30,14 @@ in
volnoti volnoti
wl-clipboard wl-clipboard
(waybar.override { pulseSupport = pulseaudio.enable; }) (waybar.override { pulseSupport = pulseaudio.enable; })
] ];
;
}; };
environment.etc = { environment.etc = {
"sway/config".text = let "sway/config".text = let
volnoti = pkgs.writeScript "volnoti.sh" (import ./volnoti.nix { inherit pkgs; }); volnoti =
in pkgs.writeScript "volnoti.sh" (import ./volnoti.nix { inherit pkgs; });
'' in ''
set $volume ${volnoti} set $volume ${volnoti}
# set background # set background
@ -88,7 +80,7 @@ in
documentation = [ "volnoti --help" ]; documentation = [ "volnoti --help" ];
wantedBy = [ "sway-session.target" ]; wantedBy = [ "sway-session.target" ];
script = ''${pkgs.volnoti}/bin/volnoti -n''; script = "${pkgs.volnoti}/bin/volnoti -n";
serviceConfig = { serviceConfig = {
Restart = "always"; Restart = "always";
@ -98,27 +90,22 @@ in
nixpkgs.overlays = let nixpkgs.overlays = let
overlay = self: super: { overlay = self: super: {
redshift = super.redshift.overrideAttrs ( redshift = super.redshift.overrideAttrs (o: {
o: {
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
owner = "CameronNemo"; owner = "CameronNemo";
repo = "redshift"; repo = "redshift";
rev = "39c162ca487a59857c2eac231318f4b28855798b"; rev = "39c162ca487a59857c2eac231318f4b28855798b";
sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58"; sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58";
}; };
} });
); wl-clipboard = super.wl-clipboard.overrideAttrs (o: {
wl-clipboard = super.wl-clipboard.overrideAttrs (
o: {
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
owner = "bugaevc"; owner = "bugaevc";
repo = "wl-clipboard"; repo = "wl-clipboard";
rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910"; rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910";
sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j"; sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j";
}; };
} });
);
}; };
in in [ overlay ];
[ overlay ];
} }

View File

@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
let let inherit (pkgs) alsaUtils bash gnugrep volnoti;
inherit (pkgs) alsaUtils bash gnugrep volnoti; in ''
in
''
#!${bash}/bin/bash #!${bash}/bin/bash
declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)") declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)")

View File

@ -29,17 +29,14 @@ let
''; '';
}; };
whitelist = concatStringsSep "|" [ whitelist = concatStringsSep "|" [ ".*pirate(bay|proxy).*" ];
".*pirate(bay|proxy).*"
];
blacklist = concatStringsSep "\n0.0.0.0 " [ blacklist = concatStringsSep ''
0.0.0.0 '' [
"# auto-generated: must be first" "# auto-generated: must be first"
# starts here # starts here
]; ];
in in { networking.extraHosts = readFile "${hosts}/etc/hosts"; }
{
networking.extraHosts = readFile "${hosts}/etc/hosts";
}

View File

@ -1,8 +1,3 @@
{ ... }: { ... }: {
{ imports = [ ./stubby.nix ./adblocking.nix ./make-linux-fast-again.nix ];
imports = [
./stubby.nix
./adblocking.nix
./make-linux-fast-again.nix
];
} }

View File

@ -2,13 +2,8 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
inherit (builtins) readFile fetchurl; inherit (builtins) readFile fetchurl;
cmdline = readFile ( cmdline = readFile (fetchurl {
fetchurl {
url = "https://make-linux-fast-again.com"; url = "https://make-linux-fast-again.com";
sha256 = "sha256:10diw5xn5jjx79nvyjqcpdpcqihnr3y0756fsgiv1nq7w28ph9w6"; sha256 = "sha256:10diw5xn5jjx79nvyjqcpdpcqihnr3y0756fsgiv1nq7w28ph9w6";
} });
); in { boot.kernelParams = pkgs.lib.splitString " " cmdline; }
in
{
boot.kernelParams = pkgs.lib.splitString " " cmdline;
}

View File

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
services.plex = { services.plex = {
enable = true; enable = true;
dataDir = "/srv/plex"; dataDir = "/srv/plex";

View File

@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
services.stubby = { services.stubby = {
enable = true; enable = true;
upstreamServers = '' upstreamServers = ''
@ -22,7 +21,6 @@
}; };
}; };
networking = { networking = {
networkmanager.dns = "none"; networkmanager.dns = "none";
resolvconf.dnsExtensionMechanism = false; resolvconf.dnsExtensionMechanism = false;

View File

@ -2,8 +2,7 @@
let let
inherit (config.services.qbittorrent) port; inherit (config.services.qbittorrent) port;
inherit (lib) mkAfter; inherit (lib) mkAfter;
in in {
{
services.qbittorrent = { services.qbittorrent = {
enable = true; enable = true;
group = "media"; group = "media";

View File

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> { } }:
let let
configs = "${toString ./.}#nixosConfigurations"; configs = "${toString ./.}#nixosConfigurations";
hostname = pkgs.lib.fileContents /etc/hostname; hostname = pkgs.lib.fileContents /etc/hostname;
@ -15,14 +15,8 @@ let
nix run -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2 nix run -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2
fi fi
''; '';
in in pkgs.mkShell {
pkgs.mkShell { nativeBuildInputs = with pkgs; [ git git-crypt nixFlakes rebuild ];
nativeBuildInputs = with pkgs; [
git
git-crypt
nixFlakes
rebuild
];
shellHook = '' shellHook = ''
mkdir -p secrets mkdir -p secrets
@ -37,6 +31,5 @@ pkgs.mkShell {
${current} ${current}
experimental-features = nix-command flakes ca-references experimental-features = nix-command flakes ca-references
''; '';
in in "${nixConf}/opt";
"${nixConf}/opt";
} }