-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add nix flake to allow nix users to install via home manager. #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,26 @@ or: | |
| cargo install mew-cli | ||
| ``` | ||
|
|
||
| nix: | ||
| ```nix | ||
| # flake | ||
| { | ||
| inputs = { | ||
| mew.url = "github:programmersd21/mew"; | ||
| }; | ||
|
|
||
| outputs = { nixpkgs, mew, ...}: | ||
| { | ||
| homeConfigurations."username" = home-manager.lib.homeManagerConfiguration { | ||
| modules = [ mew.homeManagerModules.default ]; | ||
|
Comment on lines
+73
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: The documented flake does not bind Suggested fix: Add
Comment on lines
+75
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: The documented Triggers: When a user copies the documented flake configuration without supplying Suggested fix: Pass |
||
| }; | ||
| }; | ||
| } | ||
|
|
||
| # home manager | ||
| { | ||
| programs.mew.enable = true; | ||
| } | ||
| or, last but not the least, but with **your favourite AUR helper**: | ||
|
|
||
| ```bash | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| pkgs ? import <nixpkgs> { }, | ||
| }: | ||
| let | ||
| manifest = (pkgs.lib.importTOML ./Cargo.toml).package; | ||
| in | ||
| pkgs.rustPlatform.buildRustPackage { | ||
| pname = manifest.name; | ||
| version = manifest.version; | ||
| cargoLock.lockFile = ./Cargo.lock; | ||
| nativeCheckInputs = [ | ||
| pkgs.git | ||
| ]; | ||
| doCheck = true; | ||
| src = pkgs.lib.cleanSource ./.; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||||||||||||
| { | ||||||||||||||||
| description = "a fast terminal card for your project, git state, and machine"; | ||||||||||||||||
|
|
||||||||||||||||
| inputs = { | ||||||||||||||||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||||||||||||||||
|
|
||||||||||||||||
| home-manager = { | ||||||||||||||||
| url = "github:nix-community/home-manager"; | ||||||||||||||||
| inputs.nixpkgs.follows = "nixpkgs"; | ||||||||||||||||
| }; | ||||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| outputs = | ||||||||||||||||
| { | ||||||||||||||||
| self, | ||||||||||||||||
| nixpkgs, | ||||||||||||||||
| home-manager, | ||||||||||||||||
| }: | ||||||||||||||||
| let | ||||||||||||||||
| supportedSystems = [ "x86_64-linux" ]; | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): The flake publishes packages only for Triggers: When a Nix user evaluates or enables the module on a system other than x86_64-linux. Suggested fix: Build the package for all intended systems, such as aarch64-linux and Darwin, or make the module report an explicit unsupported-system error instead of indexing a missing attribute.
Suggested change
|
||||||||||||||||
| forAllSystems = nixpkgs.lib.genAttrs supportedSystems; | ||||||||||||||||
| pkgsFor = nixpkgs.legacyPackages; | ||||||||||||||||
| in | ||||||||||||||||
| { | ||||||||||||||||
| packages = forAllSystems (system: { | ||||||||||||||||
| default = pkgsFor.${system}.callPackage ./. { }; | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| apps = forAllSystems (system: { | ||||||||||||||||
| default = { | ||||||||||||||||
| type = "app"; | ||||||||||||||||
| program = "${self.packages.${system}.default}/bin/mew"; | ||||||||||||||||
| }; | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| homeManagerModules.default = | ||||||||||||||||
| { | ||||||||||||||||
| config, | ||||||||||||||||
| lib, | ||||||||||||||||
| pkgs, | ||||||||||||||||
| ... | ||||||||||||||||
| }: | ||||||||||||||||
| let | ||||||||||||||||
| cfg = config.programs.mew; | ||||||||||||||||
| in | ||||||||||||||||
| { | ||||||||||||||||
| options.programs.mew = { | ||||||||||||||||
| enable = lib.mkEnableOption "mew"; | ||||||||||||||||
|
|
||||||||||||||||
| package = lib.mkOption { | ||||||||||||||||
| type = lib.types.package; | ||||||||||||||||
| default = self.packages.${pkgs.system}.default; | ||||||||||||||||
| description = "the mew package"; | ||||||||||||||||
| }; | ||||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| config = lib.mkIf cfg.enable { | ||||||||||||||||
| home.packages = [ cfg.package ]; | ||||||||||||||||
| }; | ||||||||||||||||
| }; | ||||||||||||||||
| }; | ||||||||||||||||
| } | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Declare and bind the
nixpkgsandhome-managerinputs.The example declares only
mew, butoutputsrequiresnixpkgsand the body referenceshome-manager. The...pattern accepts extra inputs but does not bind missing identifiers. The copied flake fails during evaluation before loading the module.Proposed correction
inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; mew.url = "github:programmersd21/mew"; }; -outputs = { nixpkgs, mew, ...}: +outputs = { nixpkgs, home-manager, mew, ...}: { homeConfigurations."username" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; modules = [ mew.homeManagerModules.default ]; }; };🤖 Prompt for AI Agents