| 5 Mar 2023 |
| ~ajhalili2006 [ ctrl-c.club / sr.ht / vern.cc ] joined the room. | 01:37:17 |
| 6 Mar 2023 |
Sandro 🐧 | Something about the sudo wrapper changed and it is broken for me. | 13:21:13 |
Sandro 🐧 | I suspect that the permissions are wrong:
▶ ls -lah /run/wrappers/bin/sudo
.r-s--x--- root wheel 17 KB Mon Mar 6 14:19:11 2023 /run/wrappers/bin/sudo
| 13:21:33 |
Sandro 🐧 | groups are fine
▶ id
uid=1000(sandro) gid=100(users) groups=100(users),1(wheel)
| 13:22:04 |
Sandro 🐧 | 🤦 | 13:22:25 |
Sandro 🐧 | I was testing PATH ordering last week and that messes it up | 13:23:23 |
| Emil Nikolov joined the room. | 15:40:39 |
| 7 Mar 2023 |
| Rowan Molony joined the room. | 17:25:23 |
henrik-ch | I am trying to get gpg working for my user on nixos wsl.
I have the following in my configuration.nix:
{ pkgs, config, modulesPath, ... }:
let
#nixvim = import (builtins.fetchGit {
# url = "https://github.com/pta2002/nixvim";
#});
nixos-wsl = import ./nixos-wsl;
in
{
imports = [
#nixvim.nixosModules.nixvim
nixos-wsl.nixosModules.wsl
<home-manager/nixos>
];
wsl = {
enable = true;
nativeSystemd = true;
wslConf.automount.root = "/mnt";
defaultUser = "nixos";
startMenuLaunchers = true;
# Enable native Docker support
# docker-native.enable = true;
# Enable integration with Docker Desktop (needs to be installed)
# docker-desktop.enable = true;
};
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
#programs.nixvim.enable = true;
users.users.i97henka = {
isNormalUser = true;
extraGroups = [ "wheel"];
};
home-manager.users.i97henka = { pkgs, ... }: {
home.stateVersion = "22.11";
home.packages = [ pkgs.jq pkgs.ripgrep pkgs.gh ];
programs.bash = {
enable = true;
shellAliases = {
ll = "ls -l";
".." = "cd ..";
gst = "git status";
glo = "git log --oneline";
gfa = "git fetch --all";
ggfl = "git push --force-with-lease";
};
};
programs.git.enable = true;
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.fzf.enable = true;
programs.bat.enable = true;
programs.gpg.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
};
};
environment.systemPackages = with pkgs; [
bat
git
vim
];
system.stateVersion = "22.11";
}
I have added programs.gpg.enable = true; but it didn't improve things.
I have seen this discourse thread: https://discourse.nixos.org/t/cant-get-gnupg-to-work-no-pinentry/15373
but I am not sure how to apply it to my configuration.nix - I only added gpg in the home manager part - but maybe it should be in a different part?
| 17:38:01 |
K900 | What exactly is not working? | 17:39:10 |
henrik-ch | Thank you for chatting back K900 . This is the command and the error:
gpg --symmetric --cipher-algo AES256 file_with_secrets.env
gpg: problem with the agent: No pinentry
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of 'file_with_secrets.env' failed: Operation cancelled
| 17:40:38 |
K900 | Maybe use the NixOS setting instead of the home-manager one? | 17:41:42 |
K900 | Looks like that got fixed to wokr by default | 17:41:47 |
henrik-ch | I change my configuration.nix, and I had problems previously to write a correct one, but now I got it through the sudo nixos-rebuild switch.
{ pkgs, config, modulesPath, ... }:
let
#nixvim = import (builtins.fetchGit {
# url = "https://github.com/pta2002/nixvim";
#});
nixos-wsl = import ./nixos-wsl;
in
{
imports = [
#nixvim.nixosModules.nixvim
nixos-wsl.nixosModules.wsl
<home-manager/nixos>
];
wsl = {
enable = true;
nativeSystemd = true;
wslConf.automount.root = "/mnt";
defaultUser = "nixos";
startMenuLaunchers = true;
# Enable native Docker support
# docker-native.enable = true;
# Enable integration with Docker Desktop (needs to be installed)
# docker-desktop.enable = true;
};
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
#programs.nixvim.enable = true;
users.users.i97henka = {
isNormalUser = true;
extraGroups = [ "wheel"];
};
home-manager.users.i97henka = { pkgs, ... }: {
home.stateVersion = "22.11";
home.packages = [ pkgs.jq pkgs.ripgrep pkgs.gh ];
programs.bash = {
enable = true;
shellAliases = {
ll = "ls -l";
".." = "cd ..";
gst = "git status";
glo = "git log --oneline";
gfa = "git fetch --all";
ggfl = "git push --force-with-lease";
};
};
programs.git.enable = true;
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.fzf.enable = true;
programs.bat.enable = true;
#programs.gpg.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
# plugins = with pkgs.vimPlugins; [
#nvim-lspconfig
#nvim-treesitter.withAllGrammars
#plenary-nvim
#gruvbox-material
#mini-nvim
# ];
};
};
environment.systemPackages = with pkgs; [
bat
git
vim
];
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "curses";
};
system.stateVersion = "22.11";
}
Sorry about the long config file chat. That worked on my nixos user - now I can generate the env.gpg file.
| 17:51:10 |
henrik-ch | Thanks a lot for guidance K900 . | 17:51:22 |
henrik-ch | There is one thing that still catches me out with that configuration.nix. It's working for the nixos user, but not for the i97henka user that I manage with home-manager. Is there an easy fix for that you think? | 18:45:00 |
K900 | Why do you have two users? | 18:46:05 |
K900 | Just have one user | 18:46:18 |
K900 | The nixos user is in no way special and doesn't need to exist | 18:46:32 |
K900 | If you don't want it to | 18:46:41 |
henrik-ch | Makes sense. | 18:46:52 |
henrik-ch | I changed the default user i my configuration.nix to i97henka. I did a nixos-rebuild switch and a wsl --shutdown and relaunched my terminal. | 18:50:43 |
henrik-ch | Unfortunately the gpg is still not working for the i97henka user. Maybe I am missing something here. | 18:51:10 |
K900 | How exactly does it "not work" + | 18:51:42 |
K900 | * How exactly does it "not work"? | 18:51:46 |
henrik-ch | good point - same one let me share:
gpg --symmetric --cipher-algo AES256 file_with_secrets.env
gpg: problem with the agent: No pinentry
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of 'file_with_secrets.env' failed: Operation cancelled
| 18:52:50 |
K900 | Are you maybe starting another instance of gpg-agent in your shell config or something? | 18:54:17 |
henrik-ch | that may be the case | 18:54:37 |
henrik-ch | [i97henka@nixos:~/github]$ which gpg
/run/current-system/sw/bin/gpg
That looks a bit unusual to me, but I haven't got much unix experience 😄
| 18:55:45 |
K900 | That is normal for NixOS | 18:55:56 |