From bdab4cfd4dcff5e45c14af8ebf8f1c795b1ac01a Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 26 May 2024 11:01:22 -0700 Subject: Add flake.nix for building on NixOS. --- .gitignore | 8 ++----- ChangeLog.md | 5 ----- Expr.hs | 2 +- RealCalc.hs | 2 +- Setup.hs | 2 -- cabal.project.freeze | 31 +++++++++++++++++++++++++++ flake.lock | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 ++++++++++++++++++++++++++ hsc.cabal | 21 +++++++++--------- main.hs | 2 +- 10 files changed, 137 insertions(+), 26 deletions(-) delete mode 100644 ChangeLog.md delete mode 100644 Setup.hs create mode 100644 cabal.project.freeze create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 6283f66..3c5bc73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ -*.hi -.cabal-sandbox -cabal.sandbox.config -dist -shell.nix -result +/dist-newstyle +/result diff --git a/ChangeLog.md b/ChangeLog.md deleted file mode 100644 index 5392899..0000000 --- a/ChangeLog.md +++ /dev/null @@ -1,5 +0,0 @@ -# Revision history for realCalc - -## 0.1 -- YYYY-mm-dd - -* First version. Released on an unsuspecting world. diff --git a/Expr.hs b/Expr.hs index 06bbea6..5d40ce8 100644 --- a/Expr.hs +++ b/Expr.hs @@ -1,5 +1,5 @@ {- - - Copyright 2018 Raymond Hogenson + - Copyright 2018 Rose Hogenson - - This file is part of HSC. diff --git a/RealCalc.hs b/RealCalc.hs index d54cf84..0fe0ae0 100644 --- a/RealCalc.hs +++ b/RealCalc.hs @@ -1,7 +1,7 @@ {-# LANGUAGE RankNTypes #-} {- - - Copyright 2018 Raymond Hogenson + - Copyright 2018 Rose Hogenson - - This file is part of HSC. diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/cabal.project.freeze b/cabal.project.freeze new file mode 100644 index 0000000..0a1c4a6 --- /dev/null +++ b/cabal.project.freeze @@ -0,0 +1,31 @@ +active-repositories: hackage.haskell.org:merge +constraints: any.array ==0.5.6.0, + any.base ==4.18.2.1, + any.binary ==0.8.9.1, + any.bytestring ==0.11.5.3, + any.cairo ==0.13.10.0, + any.containers ==0.6.7, + any.deepseq ==1.4.8.1, + any.directory ==1.3.8.4, + any.exceptions ==0.10.7, + any.filepath ==1.4.300.1, + any.ghc-bignum ==1.3, + any.ghc-boot-th ==9.6.5, + any.ghc-prim ==0.10.0, + any.gio ==0.13.10.0, + any.glib ==0.13.10.0, + any.gtk3 ==0.15.8, + any.mtl ==2.3.1, + any.pango ==0.13.10.0, + any.parsec ==3.1.16.1, + any.pretty ==1.1.3.6, + any.process ==1.6.19.0, + any.rts ==1.0.2, + any.stm ==2.5.1.0, + any.template-haskell ==2.20.0.0, + any.text ==2.0.2, + any.time ==1.12.2, + any.transformers ==0.6.1.0, + any.unix ==2.8.4.0, + any.utf8-string ==1.0.2 +index-state: hackage.haskell.org 2024-05-26T16:57:42Z diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..90b1e99 --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716742570, + "narHash": "sha256-afec5yPfTTlgObUaAPkI8/UU94YoIyApfFIQ9Sm5gx0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0c415dbace0ef240d0ea82343b0bb1414bc87fc4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0bdf16f --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: 2021 Serokell +# +# SPDX-License-Identifier: CC0-1.0 + +{ + description = "A minimalist calculator for quick calculations"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.hsc = + pkgs.haskellPackages.callCabal2nix "hsc" self {}; + + packages.default = self.packages.${system}.hsc; + defaultPackage = self.packages.${system}.default; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ cabal-install ]; + inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system}); + }; + devShell = self.devShells.${system}.default; + }); +} diff --git a/hsc.cabal b/hsc.cabal index 1f1f883..3092122 100644 --- a/hsc.cabal +++ b/hsc.cabal @@ -10,13 +10,10 @@ name: hsc -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.1 +version: 1.0 -- A short (one-line) description of the package. -synopsis: Probably something like this already exists - -description: A small calculator meant to be opened with a keybinding for quick - calculations. +synopsis: A minimalist calculator for quick calculations. -- A longer description of the package. -- description: @@ -28,11 +25,11 @@ license: GPL-3 license-file: LICENSE -- The package author(s). -author: Raymond Hogenson +author: Rose Hogenson -- An email address to which users can send suggestions, bug reports, and -- patches. -maintainer: rhogenson@posteo.net +maintainer: rosehogenson@posteo.net -- A copyright notice. -- copyright: @@ -46,7 +43,7 @@ build-type: Simple extra-source-files: ChangeLog.md -- Constraint on the version of Cabal needed to build this package. -cabal-version: >=1.10 +cabal-version: 2.0 executable hsc @@ -60,7 +57,11 @@ executable hsc -- other-extensions: -- Other library packages from which modules are imported. - build-depends: base >=4.9 && <5.0, containers >=0.5 && <1.0, parsec >=3.1 && <4.0, gtk3 >=0.14.6 && <1.0.0 + build-depends: + base^>=4.18.2.1, + containers^>=0.6.7, + parsec^>=3.1.16.1, + gtk3^>=0.15.8 -- Directories containing source files. -- hs-source-dirs: @@ -68,4 +69,4 @@ executable hsc -- Base language which the package is written in. default-language: Haskell2010 - ghc-options: -Wall -rtsopts + ghc-options: -Wall -Werror diff --git a/main.hs b/main.hs index a5c97d0..a2e1790 100644 --- a/main.hs +++ b/main.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- - - Copyright 2018 Raymond Hogenson + - Copyright 2018 Rose Hogenson - - This file is part of HSC. -- cgit v1.3.1