-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/pam: avoid extra lines in pam files #145574
nixos/pam: avoid extra lines in pam files #145574
Conversation
746b927
to
e5c599b
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-build-an-arbitrary-nixpkgs-file/16013/13 |
I would argue that the Nix expression is read more often than the output of the expression. From my point of view, the old code look more appealing to me. |
commit name should be |
e5c599b
to
02803dc
Compare
Since there are many more users than developers, I would expect the opposite. But we should definitely work on getting the most appealing code before merging. That said, this is closer to the approach taken further down in the same file. Consistency would be nice too. |
this doesn't need to target staging as there are not many rebuilds |
9219f7f
to
e1b0133
Compare
Oh, that's how it works? Rebased again, and thanks for the tip. |
are you familiar with pam? / do you have experience with it |
Only a couple basic changes to /etc/pam.d files. I think one time I swapped two entries after logging in took a long time, and another time I believe I added a keyword for some LDAP-related reason. I tried to make properly sure only empty lines were removed though, and my (limited) tests bear that out. I don't have flake support enabled, but if you have time to check using your configuration that would be useful to make sure we don't deviate semantically. Update: If you want to know why I did this, I watched this video and thought, "Hey, I've looked at PAM files before, I wonder what they're like in NixOS." |
e1b0133
to
1d13383
Compare
Your current version looks better than the original one, great! |
1d13383
to
ef58bbf
Compare
making a diff script.. |
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
};
outputs = inputs@{ self, nixpkgs }: {
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
({ pkgs, lib, modulesPath, ... }: {
krb5.enable = true;
users.mutableUsers = false;
users.users.root = {
password = "root";
};
users.users.user = {
password = "user";
isNormalUser = true;
extraGroups = [ "wheel" ];
};
imports = [
(modulesPath + "/profiles/minimal.nix")
];
})
];
};
# So that we can just run 'nix run' instead of
# 'nix build ".#nixosConfigurations.vm.config.system.build.vm" && ./result/bin/run-nixos-vm'
defaultPackage.x86_64-linux = self.nixosConfigurations.vm.config.system.build.vm;
defaultApp.x86_64-linux = {
type = "app";
program = "${self.defaultPackage.x86_64-linux}/bin/run-nixos-vm";
};
};
}
no output so there are no differences other than blank line changes |
Excellent! I don't really want to delay this any longer, but is there some way this could be made into a test? PAM is super important to get right, so it would be great to have some actual proof that it generates what we expect. |
maybe creating a vm test which runs pamtester commands http://pamtester.sourceforge.net |
rebuilt my system with this change https://nixos.wiki/wiki/Nixpkgs/Reviewing_changes#Modules
and everything seems ok |
I like the overall idea, I just wouldn't want to use a 15 year old tool hosted on an HTTP web site with a provider known for injecting stuff into the packages they host. |
Motivation for this change
Closes #145286
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
) (N/A)Test procedure (on staging this time)
Caveat: The tests above are not exhaustive - some options are mutually exclusive and some options should be passed to pam.nix rather than in config.nix. Hopefully the above will make it easy for anyone to test their favourite PAM section :)
In summary, this gets rid of a bunch of (all?) the unnecessary empty lines in /etc/pam.d files, while keeping the empty lines between sections of the file and seemingly keeping the structure of each of the entries.
@ttuegel, @bjornfor.