nixpkgs-fmt

This commit is contained in:
fleaz 2022-02-07 00:01:27 +01:00
parent 6a9a43478c
commit 04091588ee
10 changed files with 185 additions and 169 deletions

View file

@ -2,7 +2,8 @@
let
home-manager = (import ../nix/sources.nix).home-manager;
in {
in
{
imports = [
"${home-manager}/nixos"
];
@ -10,8 +11,8 @@ in {
home-manager.users.fleaz = { pkgs, ... }: {
imports = [
modules/neovim.nix
modules/vscode.nix
modules/neovim.nix
modules/vscode.nix
];
services.gnome-keyring.enable = true;
@ -194,66 +195,68 @@ in {
bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
keybindings = let mod = "Mod4";
in {
"${mod}+Return" = "exec foot";
"${mod}+p" = "exec ${pkgs.wofi}/bin/wofi --show drun";
keybindings =
let mod = "Mod4";
in
{
"${mod}+Return" = "exec foot";
"${mod}+p" = "exec ${pkgs.wofi}/bin/wofi --show drun";
"${mod}+Shift+c" = "reload";
"${mod}+Shift+q" = "kill";
"${mod}+Shift+e" =
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${mod}+x" = "move workspace to output right";
"${mod}+Shift+c" = "reload";
"${mod}+Shift+q" = "kill";
"${mod}+Shift+e" =
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${mod}+x" = "move workspace to output right";
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
"${mod}+Shift+h" = "move left";
"${mod}+Shift+j" = "move down";
"${mod}+Shift+k" = "move up";
"${mod}+Shift+l" = "move right";
"${mod}+Shift+h" = "move left";
"${mod}+Shift+j" = "move down";
"${mod}+Shift+k" = "move up";
"${mod}+Shift+l" = "move right";
"${mod}+s" = "split v";
"${mod}+w" = "split h";
"${mod}+s" = "split v";
"${mod}+w" = "split h";
"${mod}+t" = "layout tabbed";
"${mod}+r" = "mode resize";
"${mod}+t" = "layout tabbed";
"${mod}+r" = "mode resize";
"${mod}+f" = "fullscreen toggle";
"${mod}+Shift+space" = "floating toggle";
"${mod}+f" = "fullscreen toggle";
"${mod}+Shift+space" = "floating toggle";
"${mod}+1" = "workspace 1";
"${mod}+2" = "workspace 2";
"${mod}+3" = "workspace 3";
"${mod}+4" = "workspace 4";
"${mod}+5" = "workspace 5";
"${mod}+6" = "workspace 6";
"${mod}+7" = "workspace 7";
"${mod}+8" = "workspace 8";
"${mod}+9" = "workspace 9";
"${mod}+0" = "workspace 10";
"${mod}+1" = "workspace 1";
"${mod}+2" = "workspace 2";
"${mod}+3" = "workspace 3";
"${mod}+4" = "workspace 4";
"${mod}+5" = "workspace 5";
"${mod}+6" = "workspace 6";
"${mod}+7" = "workspace 7";
"${mod}+8" = "workspace 8";
"${mod}+9" = "workspace 9";
"${mod}+0" = "workspace 10";
"${mod}+Shift+1" = "move container to workspace 1";
"${mod}+Shift+2" = "move container to workspace 2";
"${mod}+Shift+3" = "move container to workspace 3";
"${mod}+Shift+4" = "move container to workspace 4";
"${mod}+Shift+5" = "move container to workspace 5";
"${mod}+Shift+6" = "move container to workspace 6";
"${mod}+Shift+7" = "move container to workspace 7";
"${mod}+Shift+8" = "move container to workspace 8";
"${mod}+Shift+9" = "move container to workspace 9";
"${mod}+Shift+0" = "move container to workspace 10";
"${mod}+Shift+1" = "move container to workspace 1";
"${mod}+Shift+2" = "move container to workspace 2";
"${mod}+Shift+3" = "move container to workspace 3";
"${mod}+Shift+4" = "move container to workspace 4";
"${mod}+Shift+5" = "move container to workspace 5";
"${mod}+Shift+6" = "move container to workspace 6";
"${mod}+Shift+7" = "move container to workspace 7";
"${mod}+Shift+8" = "move container to workspace 8";
"${mod}+Shift+9" = "move container to workspace 9";
"${mod}+Shift+0" = "move container to workspace 10";
# Multimedia Keys
"XF86AudioMute" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioRaiseVolume" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
};
# Multimedia Keys
"XF86AudioMute" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioRaiseVolume" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
};
};
};

View file

@ -1,10 +1,10 @@
{ pkgs, ... }: {
programs.vim = {
enable = true;
plugins = with pkgs.vimPlugins; [ vim-airline neoformat vim-monokai ];
settings = { ignorecase = true; };
extraConfig = ''
set mouse=a
'';
};
programs.vim = {
enable = true;
plugins = with pkgs.vimPlugins; [ vim-airline neoformat vim-monokai ];
settings = { ignorecase = true; };
extraConfig = ''
set mouse=a
'';
};
}

View file

@ -1,13 +1,13 @@
{ pkgs, ... }: {
programs.vscode = {
enable = true;
package = pkgs.vscodium; # You can skip this if you want to use the unfree version
extensions = with pkgs.vscode-extensions; [
dracula-theme.theme-dracula
vscodevim.vim
yzhang.markdown-all-in-one
ms-python.python
];
};
enable = true;
package = pkgs.vscodium; # You can skip this if you want to use the unfree version
extensions = with pkgs.vscode-extensions; [
dracula-theme.theme-dracula
vscodevim.vim
yzhang.markdown-all-in-one
ms-python.python
];
};
}

View file

@ -3,8 +3,9 @@
# and in the NixOS manual (accessible by running nixos-help).
{ sources ? import ../../nix
, pkgs ? sources.pkgs {}
, ... } :
, pkgs ? sources.pkgs { }
, ...
}:
{
imports = [
@ -42,32 +43,32 @@
dockerCompat = true;
};
# output = {
# "*".bg = "/home/fleaz/Downloads/spongebob.jpg fill";
# "DVI-D-1" = {
# mode = "1920x1200";
# transform = "270";
# position = "0,0";
# };
# "HDMI-A-1" = {
# mode = "3840x2160";
# scale = "1.2";
# position = "1200,0";
# };
# "DP-1" = {
# mode = "3840x2160";
# scale = "1.2";
# position = "4400,0";
# };
# output = {
# "*".bg = "/home/fleaz/Downloads/spongebob.jpg fill";
# "DVI-D-1" = {
# mode = "1920x1200";
# transform = "270";
# position = "0,0";
# };
# "HDMI-A-1" = {
# mode = "3840x2160";
# scale = "1.2";
# position = "1200,0";
# };
# "DP-1" = {
# mode = "3840x2160";
# scale = "1.2";
# position = "4400,0";
# };
# Multimedia Keys
# "XF86AudioMute" =
# "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
# "XF86AudioRaiseVolume" =
# "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
# "XF86AudioLowerVolume" =
# "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
# Multimedia Keys
# "XF86AudioMute" =
# "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
# "XF86AudioRaiseVolume" =
# "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
# "XF86AudioLowerVolume" =
# "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
# List packages installed in system profile. To search, run:
# $ nix search wget

View file

@ -23,13 +23,15 @@
};
fileSystems."/mnt/pool" = {
device = "//BART/Pool/";
fsType = "cifs";
options = let
device = "//BART/Pool/";
fsType = "cifs";
options =
let
# this line prevents hanging on network split
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
in
[ "${automount_opts},credentials=/etc/nixos/smb-secrets" ];
};
swapDevices =

View file

@ -7,7 +7,8 @@
let
home-manager = (import ./nix/sources.nix).home-manager;
secretsFile = "/root.key";
in {
in
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@ -40,13 +41,13 @@ in {
networking.hostName = "jimbo"; # Define your hostname.
networking.extraHosts =
''
10.32.4.64 cyberark.charite.de
10.32.4.64 cya-pvwa.charite.de
141.42.207.84 s-charitedigital.charite.de
10.32.4.65 cya-psmp.charite.de
''
10.32.4.64 cyberark.charite.de
10.32.4.64 cya-pvwa.charite.de
141.42.207.84 s-charitedigital.charite.de
10.32.4.65 cya-psmp.charite.de
'';
'';
# Set your time zone.
time.timeZone = "Europe/Berlin";
@ -56,12 +57,12 @@ in {
networking.networkmanager.enable = true;
programs.nm-applet.enable = true;
services.avahi = {
nssmdns = true;
enable = true;
ipv4 = true;
ipv6 = true;
};
services.avahi = {
nssmdns = true;
enable = true;
ipv4 = true;
ipv6 = true;
};
hardware.opengl = {
enable = true;
@ -98,8 +99,11 @@ in {
# List packages installed in system profile. To search, run:
environment.systemPackages = with pkgs; [
vim wget curl git
];
vim
wget
curl
git
];
services.openssh.enable = true;
programs.ssh.startAgent = true;

View file

@ -5,7 +5,8 @@
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
@ -14,14 +15,16 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b9edb32f-fb40-4d59-8abe-b187c88667d6";
{
device = "/dev/disk/by-uuid/b9edb32f-fb40-4d59-8abe-b187c88667d6";
fsType = "ext4";
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/e2d53876-3fdc-486a-a354-ec834b256e43";
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/502E-A0DC";
{
device = "/dev/disk/by-uuid/502E-A0DC";
fsType = "vfat";
};

View file

@ -1,4 +1,4 @@
{ ... }:{
{ ... }: {
services.openssh.enable = true;
programs.ssh.startAgent = true;
}

View file

@ -10,29 +10,29 @@ let
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
if spec ? ref then spec.ref else
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
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;
@ -66,16 +66,16 @@ let
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.
'';
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:
@ -98,10 +98,10 @@ let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
@ -112,7 +112,7 @@ let
);
# 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
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -123,43 +123,46 @@ let
concatStrings = builtins.concatStringsSep "";
# 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
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchurl attrs;
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
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 = replace name (fetch config.pkgs name spec); }
) config.sources;
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then
abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
)
config.sources;
# The "config" used by the fetchers
mkConfig =
{ 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
, pkgs ? mkPkgs sources system
}: rec {
@ -171,4 +174,4 @@ let
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View file

@ -9,5 +9,5 @@
../modules/ssh.nix
../users/fleaz.nix
];
}
}