Many changes

This commit is contained in:
Andrea Ciceri 2022-11-10 19:51:43 +01:00
parent 6b3c9e83f7
commit 6fcd4730a2
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
14 changed files with 189 additions and 224 deletions

2
.envrc
View file

@ -1,2 +1,2 @@
nix_direnv_watch_file utils/default.nix nix_direnv_watch_file flake.nix utils/default.nix
use flake use flake

View file

@ -77,7 +77,7 @@
(setenv "SSH_AUTH_SOCK" "/run/user/1000/gnupg/S.gpg-agent.ssh") (setenv "SSH_AUTH_SOCK" "/run/user/1000/gnupg/S.gpg-agent.ssh")
(set-formatter! 'nix-flake "nixFormat 2>/dev/null" :modes '(nix-mode)) (set-formatter! 'nix-smart-formatter "nixFormat ." :modes '(nix-mode))
(defun doom-modeline-set-vcs-modeline () nil) ; FIXME (defun doom-modeline-set-vcs-modeline () nil) ; FIXME

123
flake.lock generated
View file

@ -18,27 +18,6 @@
"type": "github" "type": "github"
} }
}, },
"androidPkgs": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1638562808,
"narHash": "sha256-nnGyBugMQo9WweTgpfPbJu0fHnRtxvsPQ9el2D3wPrY=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "a191ab6adb019b09d3bb919bb98dca31d83519d5",
"type": "github"
},
"original": {
"owner": "tadfisher",
"ref": "stable",
"repo": "android-nixpkgs",
"type": "github"
}
},
"comma": { "comma": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@ -60,21 +39,6 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"locked": {
"lastModified": 1637575296,
"narHash": "sha256-ZY8YR5u8aglZPe27+AJMnPTG6645WuavB+w0xmhTarw=",
"owner": "numtide",
"repo": "devshell",
"rev": "0e56ef21ba1a717169953122c7415fa6a8cd2618",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"doom-emacs": { "doom-emacs": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -342,21 +306,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"format-all": { "format-all": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -496,22 +445,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgsUnstable_2": {
"locked": {
"lastModified": 1638376152,
"narHash": "sha256-ucgLpVqhFnClH7YRUHBHnmiOd82RZdFR3XJt36ks5fE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6daa4a5c045d40e6eae60a3b6e427e8700f1c07f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1663235518, "lastModified": 1663235518,
@ -557,38 +490,6 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_5": {
"locked": {
"lastModified": 1637841632,
"narHash": "sha256-QYqiKHdda0EOnLGQCHE+GluD/Lq2EJj4hVTooPM55Ic=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "73369f8d0864854d1acfa7f1e6217f7d6b6e3fa1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1638371214,
"narHash": "sha256-0kE6KhgH7n0vyuX4aUoGsGIQOqjIx2fJavpCWtn73rc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a640d8394f34714578f3e6335fc767d0755d78f9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nose": { "nose": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -720,27 +621,6 @@
"type": "github" "type": "github"
} }
}, },
"robotnix": {
"inputs": {
"androidPkgs": "androidPkgs",
"nixpkgs": "nixpkgs_6",
"nixpkgsUnstable": "nixpkgsUnstable_2"
},
"locked": {
"lastModified": 1665920835,
"narHash": "sha256-FBe55Yz8q8lcgq5H/yClqeen7bTZtNGom6UAdAP+Pvg=",
"owner": "atemu",
"repo": "robotnix",
"rev": "dd7e83fb19c7ef7eb87d21ceb07fb44d84ddbd57",
"type": "github"
},
"original": {
"owner": "atemu",
"ref": "update/lineageos",
"repo": "robotnix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
@ -750,8 +630,7 @@
"nixosHardware": "nixosHardware", "nixosHardware": "nixosHardware",
"nixpkgsStable": "nixpkgsStable", "nixpkgsStable": "nixpkgsStable",
"nixpkgsUnstable": "nixpkgsUnstable", "nixpkgsUnstable": "nixpkgsUnstable",
"preCommitHooks": "preCommitHooks", "preCommitHooks": "preCommitHooks"
"robotnix": "robotnix"
} }
}, },
"rotate-text": { "rotate-text": {

View file

@ -13,7 +13,6 @@
agenix.url = github:ryantm/agenix; agenix.url = github:ryantm/agenix;
doomEmacs.url = github:nix-community/nix-doom-emacs; doomEmacs.url = github:nix-community/nix-doom-emacs;
comma.url = github:nix-community/comma; comma.url = github:nix-community/comma;
robotnix.url = github:atemu/robotnix/update/lineageos;
}; };
outputs = {self, ...} @ inputs: let outputs = {self, ...} @ inputs: let
@ -33,12 +32,9 @@
in { in {
inherit nixosConfigurations; inherit nixosConfigurations;
packages = androidImages;
apps = lib.foldr lib.recursiveUpdate {} [ apps = lib.foldr lib.recursiveUpdate {} [
(mkVmApps self.nixosConfigurations) (mkVmApps self.nixosConfigurations)
formatApp formatApp
androidGenerateKeysScripts
]; ];
checks = checkFormatting ./.; checks = checkFormatting ./.;

View file

@ -86,17 +86,22 @@ in {
}; };
home.packages = with pkgs; let home.packages = with pkgs; let
path = pkgs.lib.makeBinPath (with pkgs; [ path = pkgs.lib.makeBinPath [
git
jq
nix nix
nixpkgs-fmt nixpkgs-fmt
git ];
]);
nixFormat = writeScriptBin "nixFormat" '' nixFormat = writeScriptBin "nixFormat" ''
export PATH=${pkgs.lib.escapeShellArg path} export PATH=${pkgs.lib.escapeShellArg path}
if [[ ! "$(nix fmt $@)" ]] customFormatter=$(nix flake show --no-write-lock-file --no-update-lock-file --json | jq 'has("formatter")')
if [[ $customFormatter == "true" ]]
then then
nixpkgs-fmt $@ nix fmt <<< /dev/stdin
else
nixpkgs-fmt <<< /dev/stdin
fi fi
''; '';
in [ in [

View file

@ -0,0 +1,64 @@
# TODO: use upstream ytmusic when updated: https://github.com/OzymandiasTheGreat/mopidy-ytmusic/issues/68
{pkgs, ...}: let
ytmusicapi = pkgs.python310Packages.buildPythonPackage rec {
pname = "ytmusicapi";
version = "0.24.0";
format = "pyproject";
src = pkgs.python310Packages.fetchPypi {
inherit pname version;
hash = "sha256-vbSWgBze3tFLEpHdh3JXij3m5R6iAhTSjrCMaSLZalY=";
};
nativeBuildInputs = with pkgs.python310Packages; [
setuptools
setuptools-scm
];
propagatedBuildInputs = with pkgs.python310Packages; [
requests
];
};
mopidy-ytmusic = pkgs.python310Packages.buildPythonApplication rec {
pname = "mopidy-ytmusic";
version = "0.3.5";
src = pkgs.python3Packages.fetchPypi {
inherit version;
pname = "Mopidy-YTMusic";
sha256 = "0pncyxfqxvznb9y4ksndbny1yf5mxh4089ak0yz86dp2qi5j99iv";
};
postPatch = ''
substituteInPlace setup.py \
--replace 'ytmusicapi>=0.20.0,<0.21.0' 'ytmusicapi>=0.20.0'
'';
propagatedBuildInputs = with pkgs; [
mopidy
ytmusicapi
python310Packages.pytube
];
pythonImportsCheck = ["mopidy_ytmusic"];
doCheck = false;
};
in {
services.mopidy = {
enable = true;
extensionPackages = [mopidy-ytmusic] ++ (with pkgs; [mopidy-mpd mopidy-mpris]);
settings = {
mpd = {
enabled = true;
hostname = "127.0.0.1";
port = 6600;
# password = "";
max_connections = 20;
connection_timeout = 60;
# zeroconf = "Mopidy MPD server on $hostname";
};
# youtube = {
# enabled = true;
# };
};
};
}

View file

@ -2,11 +2,25 @@
pkgs, pkgs,
config, config,
... ...
}: { }: let
settings = config.programs.qutebrowser.settings;
websites = {
searx = "https://searx.be";
};
colors = {
black = "#000000";
darker-gray = "#222222";
lighter-gray = "#333333";
white = "#ffffff";
dark-white = "#aaaaaa";
less-dark-white = "#cccccc";
blue = "#0000ff";
};
in {
programs.qutebrowser = { programs.qutebrowser = {
enable = true; enable = true;
searchEngines = { searchEngines = with websites; {
DEFAULT = "https://searx.be/search?q={}&category_general=on&language=all"; DEFAULT = "${searx}/search?q={}&category_general=on&language=all";
w = "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go&ns0=1"; w = "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go&ns0=1";
np = "https://search.nixos.org/packages?sort=relevance&type=packages&query={}"; np = "https://search.nixos.org/packages?sort=relevance&type=packages&query={}";
no = "https://search.nixos.org/options?sort=relevance&type=options&query={}"; no = "https://search.nixos.org/options?sort=relevance&type=options&query={}";
@ -18,23 +32,27 @@
normal = { normal = {
"<Ctrl-V>" = "spawn mpv --force-window=immediate {url}"; "<Ctrl-V>" = "spawn mpv --force-window=immediate {url}";
",l" = ''config-cycle spellcheck.languages [" it-IT "] [" en-US "]''; ",l" = ''config-cycle spellcheck.languages [" it-IT "] [" en-US "]'';
"<z><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d'"; };
"<z><u><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d' --username-only"; insert = {
"<z><p><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d' --password-only"; "<Ctrl-p>" = ''spawn --userscript qute-pass --dmenu-invocation '${pkgs.fuzzel}/bin/fuzzel --background-color=253559cc --border-radius=5 --border-width=0 -d' --password-only --unfiltered'';
"<z><o><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d' --otp-only";
}; };
}; };
settings = { settings = {
auto_save.session = true; auto_save.session = true;
url.start_pages = ["https://searx.be"]; url = with websites; {
default_page = searx;
start_pages = [searx];
};
editor.command = [ editor.command = [
"emacsclient" "emacsclient"
"+{line}:{column}" "+{line}:{column}"
"{file}" "{file}"
"-c" "-c"
"-F"
"'(name . \\\"{file} - editor - qutebrowser\\\"))" # this is needed to keep the Emacs frame in the correct Sway workspace
]; ];
content.pdfjs = true; content.pdfjs = true;
scrolling.smooth = true; scrolling.smooth = false;
fonts = { fonts = {
default_size = "11pt"; default_size = "11pt";
tabs = { tabs = {
@ -42,15 +60,38 @@
unselected = "13pt"; unselected = "13pt";
}; };
}; };
colors = { colors = with colors; {
webpage.bg = black; # to avoid flashes when opening new tabs
tabs = { tabs = {
even = { even = {
bg = "silver"; bg = darker-gray;
fg = "#666666"; fg = dark-white;
}; };
odd = { odd = {
bg = "gainsboro"; bg = lighter-gray;
fg = config.programs.qutebrowser.settings.colors.tabs.even.fg; fg = settings.colors.tabs.even.fg;
};
};
completion = {
even.bg = darker-gray;
odd.bg = settings.colors.completion.even.bg;
fg = less-dark-white;
# match.fg = "";
item.selected = {
match.fg = blue;
# bg = "";
# fg = "";
border = {
top = settings.colors.completion.even.bg;
bottom = settings.colors.completion.even.bg;
};
};
category = {
bg = lighter-gray;
border = {
top = settings.colors.completion.even.bg;
bottom = settings.colors.completion.even.bg;
};
}; };
}; };
}; };

View file

@ -80,5 +80,9 @@
''; '';
}; };
home.packages = with pkgs; [thefuck htop-vim dig.dnsutils]; home.packages = with pkgs; [
thefuck
htop-vim
dig.dnsutils
];
} }

View file

@ -52,7 +52,6 @@
inherit bg; inherit bg;
}; };
}; };
#fonts = [ "Font Awesome" "Fira Code" ];
terminal = "footclient"; terminal = "footclient";
bars = [ bars = [
{ {
@ -61,7 +60,7 @@
]; ];
assigns = { assigns = {
"1" = [{title = ".*Mozilla Firefox$";} {title = ".*qutebrowser$";}]; "1" = [{title = ".*Mozilla Firefox$";} {title = ".*qutebrowser$";}];
"2" = [{title = ".*Emacs$";}]; "2" = [{title = "^((?!qutebrowser-editor).)*Emacs$";}];
"3" = [{title = "Slack.*";}]; "3" = [{title = "Slack.*";}];
"8" = [{title = "^Franz$";}]; "8" = [{title = "^Franz$";}];
"9" = [{title = "^Element.*";}]; "9" = [{title = "^Element.*";}];
@ -69,6 +68,7 @@
floating.criteria = [ floating.criteria = [
{title = "MetaMask Notification.*";} {title = "MetaMask Notification.*";}
{title = "Volume Control";} # pavucontrol {title = "Volume Control";} # pavucontrol
{title = "^.*editor - qutebrowser$";} # Emacs opened by qutebrowser
]; ];
input = { input = {
"*" = { "*" = {
@ -80,14 +80,21 @@
screenshotScript = pkgs.writeShellScript "screenshot.sh" '' screenshotScript = pkgs.writeShellScript "screenshot.sh" ''
filename="$HOME/shots/$(date --iso-8601=seconds).png" filename="$HOME/shots/$(date --iso-8601=seconds).png"
coords="$(${pkgs.slurp}/bin/slurp)" coords="$(${pkgs.slurp}/bin/slurp)"
${pkgs.grim}/bin/grim -t png -g "$coords" $filename ${pkgs.grim}/bin/grim -t png -g "$coords" "$filename"
wl-copy -t image/png < $filename wl-copy -t image/png < $filename
''; '';
screenrecordingScript = pkgs.writeShellScript "screenrecorder.sh" ''
filename="$HOME/shots/recording-$(date --iso-8601=seconds).mp4"
coords="$(${pkgs.slurp}/bin/slurp)"
${pkgs.wf-recorder}/bin/wf-recorder -g "$coords" -f "$filename"
wl-copy -t video/mp4 < $filename
'';
in in
lib.mkOptionDefault { lib.mkOptionDefault {
"${modifier}+x" = "exec emacsclient -c"; "${modifier}+x" = "exec emacsclient -c";
"${modifier}+b" = "exec qutebrowser"; "${modifier}+b" = "exec qutebrowser";
"${modifier}+s" = "exec ${screenshotScript}"; "${modifier}+s" = "exec ${screenshotScript}";
"${modifier}+g" = "exec ${screenrecordingScript}";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s +5%"; "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s +5%";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%-";
}; };

View file

@ -1,3 +1,4 @@
{ {
xdg.enable = true; xdg.enable = true;
xdg.mimeApps.enable = true;
} }

View file

@ -44,6 +44,7 @@
"git" "git"
"gpg" "gpg"
"helix" "helix"
"mopidy"
"mpv" "mpv"
"password-store" "password-store"
"qutebrowser" "qutebrowser"

View file

@ -17,14 +17,12 @@
"mlabs.cachix.org-1:gStKdEqNKcrlSQw5iMW6wFCj3+b+1ASpBVY2SYuNV2M=" "mlabs.cachix.org-1:gStKdEqNKcrlSQw5iMW6wFCj3+b+1ASpBVY2SYuNV2M="
"aciceri-fleet.cachix.org-1:e1AodrwmzRWy0eQi3lUY71M41fp9Sq+UpuKKv705xsI=" "aciceri-fleet.cachix.org-1:e1AodrwmzRWy0eQi3lUY71M41fp9Sq+UpuKKv705xsI="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"robotnix.cachix.org-1:+y88eX6KTvkJyernp1knbpttlaLTboVp4vq/b24BIv0="
]; ];
substituters = [ substituters = [
"https://cache.iog.io" "https://cache.iog.io"
"https://mlabs.cachix.org" "https://mlabs.cachix.org"
"https://aciceri-fleet.cachix.org" "https://aciceri-fleet.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://robotnix.cachix.org"
]; ];
}; };

View file

@ -6,8 +6,12 @@
xdg-desktop-portal-wlr xdg-desktop-portal-wlr
xdg-desktop-portal-gtk xdg-desktop-portal-gtk
]; ];
gtkUsePortal = true;
}; };
}; };
services.pipewire.enable = true; services.pipewire.enable = true;
environment.sessionVariables = {
GTK_USE_PORTAL = "1";
};
} }

View file

@ -1,12 +1,12 @@
{ {
nixpkgsUnstable,
nixosHardware,
preCommitHooks,
homeManager,
doomEmacs,
agenix, agenix,
comma, comma,
robotnix, doomEmacs,
homeManager,
nixosHardware,
nixpkgsUnstable,
preCommitHooks,
self,
... ...
}: let }: let
supportedSystems = { supportedSystems = {
@ -16,11 +16,9 @@
pkgsFor = lib.genAttrs (lib.attrValues supportedSystems) (system: nixpkgsUnstable.legacyPackages.${system}); pkgsFor = lib.genAttrs (lib.attrValues supportedSystems) (system: nixpkgsUnstable.legacyPackages.${system});
lib = nixpkgsUnstable.lib.extend (self: super: lib = nixpkgsUnstable.lib.extend (self: super: {
{
perSystem = super.genAttrs (super.attrValues supportedSystems); perSystem = super.genAttrs (super.attrValues supportedSystems);
} });
// robotnix.lib);
mkConfiguration = { mkConfiguration = {
name, name,
@ -73,40 +71,6 @@
}; };
}; };
mkAndroidConfiguration = {
name,
device,
flavor,
androidVersion,
}:
lib.robotnixSystem {
inherit device flavor;
imports = [
(../hosts + "/${name}")
];
};
androidConfigurations = {
oneplus5t = mkAndroidConfiguration {
name = "oneplus5t";
device = "dumpling";
flavor = "lineageos";
androidVersion = 12;
};
};
androidImages = lib.perSystem (system: builtins.mapAttrs (confName: conf: conf.img) androidConfigurations);
androidGenerateKeysScripts = lib.perSystem (system:
lib.mapAttrs' (confName: conf: {
name = "${confName}-generateKeys";
value = {
type = "app";
program = "${conf.generateKeysScript}";
};
})
androidConfigurations);
mkVmApp = system: configuration: let mkVmApp = system: configuration: let
shellScript = pkgsFor.${system}.writeShellScript "run-vm" '' shellScript = pkgsFor.${system}.writeShellScript "run-vm" ''
${configuration.config.system.build.vm}/bin/run-${configuration.config.networking.hostName}-vm ${configuration.config.system.build.vm}/bin/run-${configuration.config.networking.hostName}-vm
@ -146,8 +110,11 @@
checkFormattingHook = lib.perSystem ( checkFormattingHook = lib.perSystem (
system: { system: {
nix = preCommitHooks.lib.${system}.run { nix = preCommitHooks.lib.${system}.run {
src = ./.; src = self;
hooks.alejandra.enable = true; hooks.alejandra = {
enable = true;
entry = lib.mkForce formatApp.${system}.format.program;
};
}; };
} }
); );
@ -169,8 +136,6 @@
}); });
in { in {
inherit inherit
androidGenerateKeysScripts
androidImages
checkFormatting checkFormatting
formatApp formatApp
formatter formatter